0
:的Android TableLayout沒有表現得像鑑於此佈局XML片段表
<TableLayout
android:id="@+id/review_ltpv_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:stretchColumns="*">
<!-- TODO: This row's cells don't line up with the rows below. Fix. -->
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/review_text_view_look"
android:text="@string/review_look"
android:textAppearance="@style/TextBody" />
<TextView
android:id="@+id/review_text_view_taste"
android:text="@string/review_taste"
android:textAppearance="@style/TextBody" />
<TextView
android:id="@+id/review_text_view_portion"
android:text="@string/review_portion"
android:textAppearance="@style/TextBody" />
<TextView
android:id="@+id/review_text_view_value"
android:text="@string/review_value"
android:textAppearance="@style/TextBody" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp" >
<ToggleButton
android:id="@+id/review_look_positive"
style="@style/ButtonPositive"
android:onClick="onLookPositive"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_taste_positive"
style="@style/ButtonPositive"
android:onClick="onTastePositive"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_portion_positive"
style="@style/ButtonPositive"
android:onClick="onPortionPositive"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_value_positive"
style="@style/ButtonPositive"
android:onClick="onValuePositive"
android:textOn="@null"
android:textOff="@null" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dp" >
<ToggleButton
android:id="@+id/review_look_negative"
style="@style/ButtonNegative"
android:onClick="onLookNegative"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_taste_negative"
style="@style/ButtonNegative"
android:onClick="onTasteNegative"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_portion_negative"
style="@style/ButtonNegative"
android:onClick="onPortionNegative"
android:textOn="@null"
android:textOff="@null" />
<ToggleButton
android:id="@+id/review_value_negative"
style="@style/ButtonNegative"
android:onClick="onValueNegative"
android:textOn="@null"
android:textOff="@null" />
</TableRow>
</TableLayout>
我看到這一點:
爲什麼細胞之間的垂直邊界頂行也不行中與那些在下面的行?這不是一張桌子!
如果我從佈局標籤刪除android:stretchColumns="*"
它看起來更糟 - 頂行中的細胞只是一堆在左邊。
如果我添加android:layout_weight="1"
到TextViews沒有區別。
這是API級別22
簡化版,的使不同的廢料,對不起。如果這能起作用,它也會問一個問題:如果需要告知所有這些權重,TableLayout有什麼意義? – Eliot
嘗試從每個TableRow中刪除所有的layout_width和layout_height,我認爲這些屬性改變了TableLayout的行爲 – Aznhar
不幸的是,對不起。 – Eliot