在我的應用程序中,我有以下佈局,不管我給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」' –