-1
的項目我要對齊的相應列標題的項目,這裏是發生什麼事,有沒有辦法來排列這還是我需要編寫它手動感謝如何使Android上的SQLite數據庫
Name Hotness
Yan 10
我的XML代碼
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow>
<TextView
android:layout_width="fill_parent" //this is my column 1 which Name
android:layout_weight="1"
android:layout_height="fill_parent"
android:text="Names" >
</TextView>
<TextView
android:layout_width="fill_parent" //the column 2 which is Hotness
android:layout_weight="1"
android:layout_height="fill_parent"
android:text="Hotness" >
</TextView>
</TableRow>
</TableLayout>
<TextView
android:id="@+id/tvSqlInfo" //to save on the database
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="fill_parent"
android:text="get info" >
</TextView>
</LinearLayout>
我試過你的例子,但它仍然沒有對齊 – user1590096
你可能將不得不使用textviews的寬度和大小,然後再將它們添加到你的行中。你也可能需要向行添加布局參數,這意味着你可以用「table.addView(row,l);」替換「table.addView(row)」。 – zabawaba99