RecyclerView wrap_content using GridLayoutManager

I saw workarounds with LinearLayoutManager , but not with GridLayoutManager . Any ideas?

+6
source share
2 answers

I solved the problem using only one RecyclerView and using the getItemViewType(int position) method in the adapter. An example is here .

-4
source

According to the announcement in the supporting library version 23.2.0, all layout managers by default support automatic measurement. Thus, all WRAP_CONTENT and MATCH_PARENT should work correctly from now on.

Remember to update the library version in the gradle file.

 compile 'com.android.support:recyclerview-v7:23.2.0' 
+6
source

Source: https://habr.com/ru/post/988803/


All Articles