Reputation: 81
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)
Is it something that Android provides or how could I implement this? I dont know how to search for it.
Upvotes: 1
Views: 56
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