在表格行中我有2个textviews。但是当我试图显示文本时,如果文本长度很长,我无法看到所有的字符串。只有部分可见
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/Add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/restaurant_address"
android:textStyle="bold" />
<TextView
android:id="@+id/Restaurant_add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false" />
</LinearLayout>
</TableRow>
我没有得到什么是错误..我能知道我在做什么错误吗?
我已将singleline设置为false并将ellipsize设置为end。但我仍然面临同样的问题。
感谢:)
答案 0 :(得分:1)
您可以将LinearLayout放在ScrollView中,如果Text太长,您可以向下滚动,您将看到整个String。 。
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/Add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/restaurant_address"
android:textStyle="bold" />
<TextView
android:id="@+id/Restaurant_add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:singleLine="false" />
</LinearLayout>
</ScrollView>
</TableRow>
答案 1 :(得分:0)
这条线是因为: 机器人:MAXLINES = “2”
删除它就可以了!
答案 2 :(得分:0)
请使用Linearlayout代替tablerow。
答案 3 :(得分:0)
您可以选择多种解决方案......
- 将文本视图设置为多行,如下所示
yourtextview.setSingleLine(false);
- 这个不是最佳的,但你也可以减少textview的文本化......
希望这会有所帮助...