Bug系列:ScrollView嵌套RecyclerView出现

2020-07-20  本文已影响0人  Antonylr

问题场景展示:


item显示不全.png

我的界面中新手必看RecyclerView中的item超过了4个,所以显示不全。
我的解决方法:

   <com.zhy.autolayout.AutoRelativeLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:descendantFocusability="blocksDescendants">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/lrv_hot_question"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="20px"
                android:background="@color/app_bg"
                android:paddingStart="20dp"
                android:paddingEnd="20dp" />

 </com.zhy.autolayout.AutoRelativeLayout>

将RecyclerView外层使用RelativeLayout布局包裹并使用了
android:descendantFocusability="blocksDescendants"属性
参考来自:https://www.jianshu.com/p/d7db22a62e06

上一篇 下一篇

猜你喜欢

热点阅读