【发布时间】:2020-01-14 16:32:52
【问题描述】:
我有一个带有 NestedScrollView 的布局,其中包含一个 LinearLayout。
这个LinearLayout包含一个Fragment(FrameLayout作为容器)和一个包含RecyclerView的RelativeLayout。
问题是只有 RecyclerView 正在滚动,并且项目在片段下方。
理想情况下,片段应与 recyclerview 一起向上滚动。我尝试在 recyclerview 上设置 nestedScrollingEnabled = false 但这会停止所有滚动(即使对于 recyclerview 也是如此)。
这是布局:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:list="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical">
<FrameLayout
android:id="@+id/header_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical" />
<RelativeLayout
android:id="@+id/paginated_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header_container"
android:paddingLeft="@dimen/card_margin"
android:paddingRight="@dimen/card_margin">
... swiperefreshlayout, recyclerview here.
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</layout>
谁能告诉我怎么了?
【问题讨论】:
标签: android android-layout android-fragments android-recyclerview