etsy / AndroidStaggeredGrid

An Android staggered grid view which supports multiple columns with rows of varying sizes.
https://github.com/etsy/AndroidStaggeredGrid
4.76k stars 1.13k forks source link

grid_padding(Top|Bottom) and item_margin problem #92

Closed tomrozb closed 10 years ago

tomrozb commented 10 years ago

XML:

<com.etsy.android.grid.StaggeredGridView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/staggered_grid_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:column_count="2"
    app:grid_paddingBottom="200dp"
    app:grid_paddingLeft="20dp"
    app:grid_paddingRight="20dp"
    app:grid_paddingTop="200dp"
    app:item_margin="0dp" />

Fragment:

    @Override
    public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        StaggeredGridView staggeredGridView =
                (StaggeredGridView) inflater.inflate(R.layout.grid_container, container, false);
        return staggeredGridView;
    }

How does it look like: Imgur

What's wrong:

Am I doing something wrong? I want to disable the margin between items and set the Top|Buttom padding. To remove the item margin I have to set the item_margin to -16dp, but then the first row is not fully visible. Any suggestions?