Reputation: 145
I am using Gridview to put the images inside it, I split one image into small pieces of equal length and width e.g number of column=4 and number of rows=4 then I put the pieces in ArrayList when I put the number of column equal count of pieces e.g 4 I get more space between the rows but when I put the number of column equal 2 I don't get more space and it is ok. what I should do to put the number of column as I split it e.g 4 in the example and not 2 !
Note: the width of large image before the split equal width of screen.
this is my grid view
<GridView
android:id="@+id/vincentgridview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:horizontalSpacing="5dp"
android:verticalSpacing="5dp"
android:adjustViewBounds="true"
android:stretchMode="columnWidth"
android:layout_marginTop="30dp" >
and this is grid view item
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Upvotes: 0
Views: 4407
Reputation: 1914
Please try this
<ImageView
android:id="@+id/imageView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
Upvotes: -1
Reputation: 2180
Delete this lines
android:horizontalSpacing="5dp"
android:verticalSpacing="5dp"
or Change to..
android:horizontalSpacing="0dp"
android:verticalSpacing="0dp"
It should work fine.
Upvotes: 2