我正在尝试做一个计时器应用程序的实践,我遇到了一个问题,其中gridview没有与其他大小相同的大小。android gridview等大小的单元
这是代码
<GridLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_below="@id/passwordField"
android:columnCount="3"
android:rowCount="4"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth">
<Button
android:id="@+id/btnOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_gravity="fill_horizontal"
android:layout_row="0"
android:onClick="addInput"
android:text="@string/one" />
<Button
android:id="@+id/btnTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_gravity="fill_horizontal"
android:layout_row="0"
android:onClick="addInput"
android:text="@string/two" />
<Button
android:id="@+id/btnThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_column="2"
android:layout_gravity="fill_horizontal"
android:layout_row="0"
android:onClick="addInput"
android:text="@string/three" /> </GridLayout>
有后多个按钮的一部分,但是这是所有我需要表明现在 你可以从图像中看到:
它没有相同的单元格大小,其中第3列比其他列大。 我该如何解决这个问题?
我有RelativeLayout之前与正确的地方的一切,但按钮没有伸出来填补宽度。
您可以尝试使用机器人:在按钮的观点重量属性等于体重/大小分配给所有的意见 – AndRSoid
更改网格布局宽度来包装内容 –
只有用于api 22及以上的layout_columnweight是你的意思吗? –