RecycleView set wrong height for items

前端 未结 3 441
长情又很酷
长情又很酷 2020-12-29 07:47

I search answer for me, but didn\'t find work answer for me. I got strange error in viewing my items in RecycleView:

I use different view\'s for Recycl

相关标签:
3条回答
  • 2020-12-29 08:33

    I encountered the same problem. If you only change RecyclerView to wrap_content, the startup page looks fine but you will get blank space after swiping up.

    Solution: In addition to change android:layout_height of RecyclerView to wrap_content, you should also go to the layout XML file where your RecyclerView items are, and modify the surrounding RelativeLayout's android:layout_height attribute to wrap_content.

    Please refer to this thread.

    0 讨论(0)
  • 2020-12-29 08:40

    Set wrap_content for the recyclerview and for your viewholder layout parent. This worked for me.

    0 讨论(0)
  • 2020-12-29 08:47

    Set wrap_content instead of match_parent ( if you set as match_parent ) as that causes the layout to match the parent giving you the large spaces.

    0 讨论(0)
提交回复
热议问题