在表行中我有 2 个 TextView 。但是当我试图显示文本时,如果文本长度很长,我就看不到所有的字符串。仅部分可见
<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 设置为结束。但我仍然面临同样的问题。
谢谢:)
最佳答案
您可以将 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>
关于android - 无法在textview中查看所有文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16032788/