Android 无法在textview中查看所有文本
在表行中,我有两个文本视图。但是当我试图显示文本时,如果文本长度很长,我无法看到所有的字符串。只有部分可见Android 无法在textview中查看所有文本,android,Android,在表行中,我有两个文本视图。但是当我试图显示文本时,如果文本长度很长,我无法看到所有的字符串。只有部分可见 <TableRow android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="fill_parent"
<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。但我仍然面临着同样的问题
谢谢:)这一行之所以出现,是因为: android:maxLines=“2”
移除它,它就会好起来 这一行之所以出现,是因为: android:maxLines=“2”
移除它,它就会好起来 您可以将LinearLayout放入ScrollView,如果文本太长,您可以向下滚动,您将看到整个字符串
<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>
您可以在ScrollView中显示线性布局,如果文本太长,您可以向下滚动,您将看到整个字符串
<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>
请使用Linearlayout代替tablerow。请使用Linearlayout代替tablerow。您可以选择多种解决方案
-将textview设置为多行,如下所示
yourtextview.setSingleLine(false);
-这不是最佳选择,但您也可以减少textview的textsize
希望这有帮助…您可以选择多种解决方案 -将textview设置为多行,如下所示
yourtextview.setSingleLine(false);
-这不是最佳选择,但您也可以减少textview的textsize
希望这有助于……删除android:maxLines=“2”@Chirag我试过了。。但我仍然面临同样的问题,甚至我也尝试添加scrolview。。但这并不能解决问题。我试过了。。但我仍然面临同样的问题,甚至我也尝试添加scrolview。。但这并不能解决问题