【发布时间】:2011-07-20 09:27:55
【问题描述】:
我有一个使用 TextView 动态填充的 ListView:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/transport_selection"
/>
</LinearLayout>
但我想在 Activity 顶部添加按钮,所以我首先将我的 ListView 移动到 TableLayout 中:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow android:id="@+id/tableRow2" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/transport_selection"
/>
</TableRow>
</TableLayout>
但是,TextViews 中的文本被截断:它越过了屏幕的右侧。
我为 android:layout_width 属性尝试了不同的值,但没有任何改变。
有什么想法吗?
问候,
【问题讨论】:
标签: android textview tablelayout