Vote count:
0
I have a gridView in which I'm randomly drawing images into either a 4 by 4, 5 by 5 or 6 by 6 grid and I need the height of the grid and vertical spacing between images to be the same as that of the width, any ideas on how I could achieve this?
This is the code I currently have:
if (convertView == null) {
randomPosition = rng.nextInt(gridSize);
imageView = new ImageView(mContext);
imageView.setPadding(2, 2, 2, 2);
imageView.setScaleType(ScaleType.FIT_XY);
}
<GridView
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_centerInParent="true"
android:layout_marginTop="50dp"
android:columnWidth= "50dp"
android:stretchMode="spacingWidthUniform"
android:gravity="center"
android:clickable="true">
</GridView>
asked 55 secs ago
Make a GridViews Height Match the Width?
Aucun commentaire:
Enregistrer un commentaire