我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/left_col"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="500dp"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>recyclerView的高度由代码预先定义,等于设备屏幕的高度。这个想法是,用户在屏幕上不会感觉到2个垂直滚动(也就是说,让他看起来像1个滚动)。如何使当textView1在recyclerView开始前平滑滚动内容时,停止然后滚动通过recyclerView内部
发布于 2018-05-30 23:06:29
如果我没理解错的话,你有一些选择:
RecyclerView之外,请将NestedScrollView更改为另一种ViewGroup,如LinearLayout.recyclerView.setNestedScrollingEnabled(false);以编程方式禁用
此外,由于您使用的是静态高度android:layout_height="500dp",因此您的recyclerView将不具有动态屏幕大小
https://stackoverflow.com/questions/50607132
复制相似问题