【发布时间】:2015-09-11 21:57:32
【问题描述】:
我在NestedScrollView 中布局RecyclerView,我想让NestedScrollView 滚动与RecyclerView,但这仅在recyclerView 到达末尾时发生,下面是我的布局代码:
<android.support.v4.widget.NestedScrollView
android:id="@+id/lists_frame"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
tools:context="com.example.niuky.design.MainActivity4"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<View
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="256dp"
android:background="@color/material_blue_grey_800"
/>
<View
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/material_blue_grey_950"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="700dp"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
这是我的运行时视图:
【问题讨论】:
-
您为什么不使用支持
CoordinatorLayout和AppBarLayout和NestedScrollView来代替? -
@tato.rodrigo 首先我使用
CoordinatorLayout和AppBarLayout但我无法得到我想要的。你有什么想法吗?非常感谢! -
@tato.rodrigo 如果我们不想使用设计支持库怎么办?
NestedScrollView应该允许我们做这样的事情......但是,正如谷歌最近习惯的那样,根本没有文档。 -
@acntwww 嗨,我现在遇到了同样的问题,您找到解决此问题的方法了吗? :)
标签: android scrollview android-recyclerview