How to create a map with various types of content and layouts in Android?

How to create a multi-format map view in Android? I created the same map view, which is similar to the grid view using the recycler view and the map view. Now I want to create an idea of ​​maps, where the first map has a full width and some height, the others - half the width, but different heights. As mentioned below, where each card has different layouts and sizes.

Any guidance is really helpful. Any sample code will be great.

enter image description here

+4
source share
2 answers

If you use RecyclerView to display maps, you can configure the layout manager on the StaggeredGridLayoutManager:

mRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);

// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);

// use a linear layout manager
mLayoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);

, . LayoutParams. LayoutParams : http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html

, !

0

, . StaggeredGridLayoutManager

0

All Articles