一、解决ScollView嵌套recyclerView显示不全问题
一般应用于recyclerView的item含有输入功能(获取焦点)
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants">
<android.support.v7.widget.RecyclerView
android:id="@+id/people_rec"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
</RelativeLayout>
父类添加属性:android:descendantFocusability="beforeDescendants"
该属性是当一个为view获取焦点时,定义viewGroup和其子控件两者之间的关系。
属性的值有三种:
beforeDescendants:viewgroup会优先其子类控件而获取到焦点
afterDescendants:viewgroup只有当其子类控件不需要获取焦点时才获取焦点
blocksDescendants:viewgroup会覆盖子类控件而直接获得焦点
二、解决ScollView嵌套recyclerView滑动不流畅的问题
添加属性: recyclerview.setNestedScrollingEnabled(false);