Recycler view item fill up entire recycler view height after upgrading support library from “23.1.1” to “23.2.1”

后端 未结 7 2257
天命终不由人
天命终不由人 2020-12-24 06:28

Previously, I\'m using the following old support libraries \"23.1.1\".

compile \'com.android.support:appcompat-v7:23.1.1\'
compile \'com.android.support:supp         


        
相关标签:
7条回答
  • 2020-12-24 07:10

    The good news:

    I can pinpoint you to the exact version that changed RecyclerView's behavior: it's not a change in 23.2.1 but rather a change in 23.2.0 (February 2016). More specifically:

    RecyclerView.LayoutManager no longer ignores some RecyclerView.LayoutParams settings, such as MATCH_PARENT in the scroll direction.

    Note: These lifted restrictions may cause unexpected behavior in your layouts. Make sure you specify the correct layout parameters.

    Indeed if you fire up the 23.2.0 libraries, you will see the same behavior. That behavior can be simplified in your case as:

    Now, when you have RecyclerView's children with android:layout_x="match_parent", that will affect RecyclerView's android:layout_x, which was not the case in 23.1.1 and earlier versions.

    The bad news:

    Even if I'm 99% sure that this is the reason behind your problem, I still can't see an issue in your code. I've actually set up a RecyclerView with your XML structure (changing just the color/background parameters), with a LinearLayoutManager and it works as expected in 23.2.1. I can share my implementation if you want to perform a sanity check.

    You should double check your adapter implementation/manipulation even if it's far-stretched.

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