Android TextView中的长文本
我想在文本视图中显示长文本。这是我的XML:Android TextView中的长文本,android,textview,Android,Textview,我想在文本视图中显示长文本。这是我的XML: 这就是它的样子: 长文本不合适。我必须更改什么? <TableLayout android:layout_width="fill_parent" android:layout_height="100dip" android:layout_weight="1" > <TableRow android:id="@+id/tableRow
这就是它的样子:长文本不合适。我必须更改什么?
<TableLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:layout_weight="1" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:padding="5dip"
android:text="@string/text" />
<TextView
android:id="@+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="right"
android:text="@string/lorem" />
</TableRow>
</TableLayout>
取决于您想要实现的样式:如果可以有多行代码,您只需在xml中添加即可
android:singleLine="false"
或
如果没有,您可以允许使用
android:scrollHorizontally="true"
你想让它看起来像什么?你想让它换行并且改变文本视图的高度吗?是的,我想让整个文本适合屏幕。如果你只想让Lorem Ipsum填充整个屏幕,那么TableLayout的用途是什么?可能的答案也取决于此(@string/text)是否应该可见?它很小?等等@Heiko Rupp:第一个“Lorem Ipsum:”是@string/text。这只是一个摘录,我真的需要一个TableLayout。我想指出的是TableLayout上的shrinkColumns和stretchColumns属性,如果左栏只显示一个(小)数字,这可能会有所帮助。在这里,左列可以缩小,以便在右列中留出更多的空间来显示全文。@WarrenFaith应该是什么;)不确定,只是看起来不对。。。但是,嘿,我不是以英语为母语的人,所以我可能弄错了:)@gtumca-MAC你毁了我的笑话:/@WarrenFaith:这只是一个示例文本。。。你是安卓开发者吗?
android:lines="2"
android:scrollHorizontally="true"