vivek verma
vivek verma

Reputation: 1766

How to design a grid layout as shown in the screenshot in android?

I am able to query all the images from my device and display them in a linearlayout with a recyclerview but actually i want to display image thumbnails like its shown in android gallery app where the image size is different but they somehow adjust to fit and cover all space

gallery

plz check the image link as i can't post it in my question because of low reputation

Upvotes: 0

Views: 56

Answers (1)

Ajay Pandya
Ajay Pandya

Reputation: 2457

For creating a grid with like your requirement you can get concept from link there are lot of custom grid available on github but this is most common find it here

This is example for how to define in 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/grid_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:item_margin="8dp"
    app:column_count="@integer/column_count" />

Upvotes: 1

Related Questions