我有一个表格布局,有两行。
Textview 的宽度不会填满表格行的整个宽度,但它填满了高度。
表格行的大小正确,填充了一半的高度和整个宽度。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:layout_weight="1"
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
最佳答案
添加到你的 TextView
android:layout_weight="1"
关于android - TextView 不会填满父宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24548338/