我正在尝试使用 GridLayout 并且无法扩展行(使用 TextViews)以“填充”布局中的空间。
垂直图片(注意红线是行应该展开的地方):
横向图片:
主.xml:
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:useDefaultMargins="true" >
<TextView
style="@android:style/TextAppearance.Large"
android:layout_columnSpan="2"
android:layout_gravity="center_horizontal"
android:padding="8dp"
android:text="Which means: lacking in originality as to be obvious and boring." />
<Space android:layout_height="24dp" android:layout_columnSpan="2" />
<TextView style="@style/AnswerLetter" android:text="A." />
<TextView style="@style/AnswerChoice" android:text="ascetic" />
<TextView style="@style/AnswerLetter" android:text="B." />
<TextView style="@style/AnswerChoice" android:text="banal" />
<TextView style="@style/AnswerLetter" android:text="C." />
<TextView style="@style/AnswerChoice" android:text="contraption" />
<TextView style="@style/AnswerLetter" android:text="D." />
<TextView style="@style/AnswerChoice" android:text="dominion" />
<TextView style="@style/AnswerLetter" android:text="E." />
<TextView style="@style/AnswerChoice" android:text="enervation" />
</GridLayout>
样式.xml:
<style name="AnswerLetter" parent="@android:style/TextAppearance.Medium">
<item name="android:layout_gravity">right</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:textStyle">bold</item>
<item name="android:gravity">center_vertical|center_horizontal</item>
</style>
<style name="AnswerChoice" parent="@android:style/TextAppearance.Large">
<item name="android:layout_gravity">left</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:gravity">left</item>
</style>