我正在尝试将 TextViews 放入屏幕中,以便每个 textview 包含一个长句的 1 个单词。
这是一个很长的句子,长到屏幕上都放不下。
这里fit in the screen
有 4 个文本视图,我需要移到下一行。基本上,这样我就可以获得每个单词的点击事件(因为我需要支持 Android 2.2,而 Spannable 需要 2.2 不支持的 getX 和 getY)。
布局
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:fitsSystemWindows="true"
android:orientation="horizontal" >
<TextView
android:id="@+id/word1"
style="@style/select_part_of_speech_word" />
<TextView
android:id="@+id/word2"
style="@style/select_part_of_speech_word" />
..... more TextViews.....
<TextView
android:id="@+id/word15"
style="@style/select_part_of_speech_word" />
</LinearLayout>
应用样式
<style name="select_part_of_speech_word" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">10dp</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:text">@string/randomTutorialText</item>
<item name="android:textColor">@android:color/black</item>
<item name="android:textSize">25sp</item>
<item name="android:visibility">visible</item>
<item name="android:lines">1</item>
</style>
有了这个,文本视图似乎就消失了。我想如果我使用水平滚动视图,我将能够查看所有 15 个文本视图,但我需要它们溢出到下面的下一个可用空间。这可以做到吗?