我很努力讓表格單元格的內容左右對齊。我的代碼是:Android對齊表格的內容
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/tableRow4"
android:layout_weight="1" >
<ImageButton
android:id="@+id/button_one"
android:layout_height="fill_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/button_one" />
<ImageButton
android:id="@+id/button_two"
android:layout_height="fill_parent"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/button_two" />
</TableRow>
....
我想2的ImageButton對緊貼地配合在一起,在中間,但目前還有一定的差距 - 它看起來像每個小區爲中心的內容。表格擴展到屏幕的全部大小,共有4行,與上面相同。我希望圖像按鈕調整大小以填充屏幕,同時保持寬高比。
我試過設置在圖像按鈕的嚴重性,但它似乎沒有工作(它只有幾個像素移動它)。
試過了,也不行。我想這也許是因爲我也在擴大那些造成混亂的按鈕。 – magritte