-
Notifications
You must be signed in to change notification settings - Fork 184
Extra pixels around each item #29
Comments
Do you talk about the background of each item's view or the space between the items? |
I mean the space between the elements. |
Although in my xml there is no padding, margin, etc.. items are always slightly apart, unless I specify a width for the entire set ... |
In particular what I do is to specify values for variables widthMode and heighMode. That way extra spaces go away. I don't know if this makes any sense for you... |
Well, i have a hard time just figuring what that extra space is. Could you send a picture? |
In auto mode, the grid will try to fit the maximum number of item in a row. It is your item view created in your adapter that specify its size. In the example, the padding is 15, so the extra space comes from that padding + the space needed to lay the items evenly in the row. You can manually specify the row and column count. If you go that route, the grid will resize the items so they will fit with the specified values. |
Thank you so much for the clarification. Now i'm trying to add some margin to the entire ScrollView and this is what i get: The code for the ScrollView is:
The entire set moves to the left when there is space enough to fill the remaining gaps and be centered. Any clues? |
Well, the scroll view wrapping in the example is kind of an ugly patch for the lack of vertical scrolling in the grid. My guess is the grid does not know about the scrollview margin so it takes the screen width to compute its page width. Try to put a margin in both to see... |
How can i get rid of the extra space around each item? It seems a default behaviour that i cannot override from my xml layout. In GridView I think this can be done with the property android:listSelector="@android:color/transparent".
Any ideas? Thanks in advance.
The text was updated successfully, but these errors were encountered: