在网格布局中调整 imageViews 的大小
Resize imageViews in a grid layout
我正在尝试在 android 中创建 Tria 游戏。
我创建了一个 3 行 3 列的网格布局。
在单元格内有 9 个正方形图像视图。
我想占据网格布局的所有space,并且图像必须具有相同的尺寸。
我该怎么做?
有布局
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:columnCount="3"
android:rowCount="3">
这是 imageView 的示例
<ImageView
android:id="@+id/imageView9"
android:layout_width="48dip"
android:layout_height="48dip"
app:srcCompat="@drawable/android" />
(48dip 用于实验)
而不是根据权重给出固定的宽度和高度
android:layout_weight="1"
我正在尝试在 android 中创建 Tria 游戏。 我创建了一个 3 行 3 列的网格布局。 在单元格内有 9 个正方形图像视图。 我想占据网格布局的所有space,并且图像必须具有相同的尺寸。 我该怎么做?
有布局
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:columnCount="3"
android:rowCount="3">
这是 imageView 的示例
<ImageView
android:id="@+id/imageView9"
android:layout_width="48dip"
android:layout_height="48dip"
app:srcCompat="@drawable/android" />
(48dip 用于实验)
而不是根据权重给出固定的宽度和高度
android:layout_weight="1"