由於自定義ScrollView使得嵌套在裏面的Recyclerview條目顯示不全,原因是sdk兼容到23版本以上就會出現這個問題
解決:
1.RecyclerView上再嵌套一層RelativeLayout然後添加屬性android:descendantFocusability="blocksDescendants"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
2.使用NestedScrollView代替ScrollView然後添加屬性android:nestedScrollingEnabled="false"