Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Extra pixels around each item #29

Open
JAlcaraz opened this issue Jun 20, 2013 · 9 comments
Open

Extra pixels around each item #29

JAlcaraz opened this issue Jun 20, 2013 · 9 comments

Comments

@JAlcaraz
Copy link

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.

@mrKlar
Copy link
Owner

mrKlar commented Jun 20, 2013

Do you talk about the background of each item's view or the space between the items?

@JAlcaraz
Copy link
Author

I mean the space between the elements.

@JAlcaraz
Copy link
Author

Although in my xml there is no padding, margin, etc.. items are always slightly apart, unless I specify a width for the entire set ...

@JAlcaraz
Copy link
Author

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...

@mrKlar
Copy link
Owner

mrKlar commented Jun 20, 2013

Well, i have a hard time just figuring what that extra space is. Could you send a picture?

@JAlcaraz
Copy link
Author

Would like to get what appears on the image on the right. Is it possible?

clearextraspace

@mrKlar
Copy link
Owner

mrKlar commented Jun 20, 2013

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.

@JAlcaraz
Copy link
Author

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:

clearextraspace_globalmargins

The code for the ScrollView is:

<ScrollView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp">

    <ca.laplanete.mobile.pageddragdropgrid.PagedDragDropGrid
        android:id="@+id/gridview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
/>

</ScrollView>

The entire set moves to the left when there is space enough to fill the remaining gaps and be centered. Any clues?

@mrKlar
Copy link
Owner

mrKlar commented Jun 21, 2013

Well, the scroll view wrapping in the example is kind of an ugly patch for the lack of vertical scrolling in the grid.
The vertical scroll for each page is in dev, but is a big rewrite so i do not have a release date.

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...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants