我刚刚发现 Android 有GridLayout,我写了这个小演示:
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:columnCount="2"
android:rowCount="2" >
<Button
android:id="@+id/button1"
android:layout_row="0"
android:layout_rowSpan="1"
android:layout_column="0"
android:layout_columnSpan="1"
android:layout_gravity="fill"
android:text="Button 1" />
</GridLayout>
由于我将rowCountand都设置columnCount为 2,并且将 and 都rowSpan设置columnSpan为 1,所以我期望这样的结果:

但是,这是我实际得到的:

有谁知道我应该如何解决这个问题?还是我用GridLayout错了方式?谢谢!