回收器视图在安卓中滚动其他布局


<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_bg"
android:isScrollContainer="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:nestedScrollingEnabled="false">
<TextView
android:id="@+id/txt_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="abcd" />
<EditText
android:id="@+id/et_interest_search"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_interest_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"/>
</LinearLayout>
<ImageView
android:id="@+id/fab_submit_interest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:background="@drawable/next_arrow" />
</android.support.design.widget.CoordinatorLayout>

大家好,我的代码如上所示。我不想滚动整个布局。我只想recyclerview滚动。谁能建议如何实现这一目标?

将布局替换为以下 xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_bg"
android:isScrollContainer="false">

<TextView
android:id="@+id/txt_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="abcd" />
<EditText
android:id="@+id/et_interest_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_search" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_interest_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/et_interest_search"
android:nestedScrollingEnabled="false" />

<ImageView
android:id="@+id/fab_submit_interest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:background="@drawable/next_arrow" />
</RelativeLayout>

最新更新