6

I've seen workarounds with LinearLayoutManager, but not with GridLayoutManager. Any ideas?

alan_derua
  • 2,252
  • 3
  • 20
  • 19
  • Can you ellaborate? What exactly is the issue? – TheoK Jun 09 '15 at 21:06
  • 2
    @TheoK `RecyclerView` ignores the attribute `wrap_content` and assumes that it's height is 0. The issue is mentioned [here](http://stackoverflow.com/questions/27475178/how-do-i-make-wrap-content-work-on-a-recyclerview). There is a solution for `LinearLayoutManager` but not for `GridLayoutManager`. – alan_derua Jun 10 '15 at 11:55

2 Answers2

6

According to the announce of a support library version 23.2.0 all default layout managers support auto-measurement now. So all WRAP_CONTENT and MATCH_PARENT should work correctly from this moment.

Don't forget to update version of a library in gradle file.

compile 'com.android.support:recyclerview-v7:23.2.0'
nicolausYes
  • 633
  • 8
  • 33
-4

I've solved the problem by using only one RecyclerView and using getItemViewType(int position) method in the adapter. Example here.

alan_derua
  • 2,252
  • 3
  • 20
  • 19