diego10
diego10

Reputation: 81

Android how to achieve this listview in Android?

I am building an application and I want to make a listview like the one in the following picture. The number of items that are displayed in every line changes depending on the device's orientation (2 vertically, 1 horizontally)

enter image description here

Is it something that Android provides or how could I implement this? I dont know how to search for it.

Upvotes: 1

Views: 56

Answers (1)

H Raval
H Raval

Reputation: 1903

You can use Recyclerview with GridView for this. First get orientation by `

Activity.getResources().getConfiguration().orientation`

Then set gridview layout for recyclerview and

recyclerView.setLayoutManager(new GridLayoutManager(this, 2));

Here 2 will set two vertical lines.you can set span size according to your need.

Upvotes: 1

Related Questions