在我的应用程序中,我有以下布局,不管我给textview的值是什么,都不会改变它的宽度。有人可以帮助我纠正这种布局。TextView在屏幕上显示很小
下面是XML代码:
<?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="?android:attr/listPreferredItemHeight"
android:layout_marginTop="15dp"
android:descendantFocusability="blocksDescendants" >
<TableRow
android:layout_width="match_parent"
android:gravity="center_horizontal" >
<TextView
android:id="@+id/rec_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/fill_rece"
android:ems="10"
android:focusable="false"
android:padding="10dp"
android:textColor="#FFFFFF" />
<ImageButton
android:id="@+id/btn_rec_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/content"
android:src="@drawable/ipad_postcare_landscape_from" />
</TableRow>
</TableLayout>
我还得到附近的TableRow警告说:“这种布局的TableRow或其TableLayout父母也没用”。请指导我。
在此先感谢。
你尝试“FILL_PARENT”为TextView中的“layout_width”属性的文本视图和图像按钮空间等量的? – user1406716
@ user1406716'fill_parent'已弃用,使用'match_parent'是正确的。 –
remove'android:ems =“10”' –