How To Make StaggeredGridView In Android


Step1: Compile in Gradle

dependencies {
    compile 'com.etsy.android.grid:library:1.0.5'
}

Step2: Add the StaggeredGridView to your Layout

<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/grid_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:item_margin="8dp"
        app:column_count="@integer/column_count" />

Step3: Setup an adapter

ListAdapter adapter = ...;

StaggeredGridView gridView = (StaggeredGridView) findViewById(R.id.grid_view);

gridView.setAdapter(adapter);

Share on Google Plus

About Mayank Sharma

Mayadi is a knowlage source. You can learn, explore and play many things in a proper way. Mayadi Provides Best, Perfect and Quality Information. subscribe our youtube channel to be updated and and don't forget to take a look on our blog within every week, because we are here to upgrade your knowladge. We love to see you again and again and again...
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment