I made a Grid View with 6 columns and 60 rows. Where I can add, move and erase images. But I'm having trouble to set the distance between columns (I don't want any space between columns). Since it will change deppending on screen size. I set it up for my phone, then tried it at a friends phone and there where like 10dp between columns. Heres the xml for the GridView EDIT: and if I try it in a smaller phone the images where to big to fit the cell.
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_grid_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:numColumns="@integer/num_columns"
android:stretchMode="columnWidth" />
Heres the java code for the layout
ImageCell v = null;
if (convertView == null) {
v = new ImageCell (mContext);
v.setLayoutParams(new GridView.LayoutParams(80, 80));
v.setScaleType(ImageView.ScaleType.CENTER_CROP );
} else {
v = (ImageCell) convertView;
}
I tried changing that v.setLayoutParams... to
v.setLayoutParams(new GridView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ));
and
v.setLayoutParams(new GridView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
But those two maked the GridView unable to use. If anyone have any idea of what am I doing wrong please tell me, if someone needs something else also ask for it (I can't post screenshots)