【发布时间】:2016-05-11 12:18:47
【问题描述】:
我有一个 GridLayout,里面有 6 个 LinearLayout 孩子。里面是按钮和其他东西。
在 Android Studio 中它看起来不错,但在实际设备(甚至模拟器)上它的空间并不均匀。这是正在发生的事情的图片。
<RelativeLayout <!--main layout stuff-->
>
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rowCount="4"
android:columnCount="2">
<!--
there are six of these inside the grid layout
-->
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight="1"
android:layout_rowWeight="1">
<ImageButton
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/button"
android:src="@drawable/button"
android:layout_gravity="center"/>
</LinearLayout>
</GridLayout>
</RelativeLayout>
【问题讨论】:
-
您在哪个设备上测试?
-
HTC One Mini、三星和模拟器
-
我建议你使用Gridview自定义
标签: android xml android-linearlayout grid-layout android-relativelayout