滚动视图内的 Recyclerview- 如何滚动整个内容? [英] Recyclerview inside scrollview- How to scroll whole content?

查看:35
本文介绍了滚动视图内的 Recyclerview- 如何滚动整个内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Scrollview 中有 Recyclerview

I am having Recyclerview inside Scrollview

 <Scrollview
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

    <LinearLayout
        android:id="@+id/layoutStaticContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

       //Static content.
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="100dp">
           .
           .
        <LinearLayout>

         //Dynamic content(newsfeed)
         <android.support.v7.widget.RecyclerView
            android:id="@+id/recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />

    </LinearLayout>
 </ScrollView>

现在滚动时,layoutStaticContent 固定在顶部 &recyclerview 内容在底部独立滚动.如何滚动整个内容,即(layoutStaticContent + recyclerview 内容),以便只有 1 个滚动视图?我也尝试用 Nestedscrollview 替换滚动视图,但没有成功.

Now while scrolling, layoutStaticContent stays fix on the top & recyclerview content scrolls independently in the bottom part. How to scroll the whole content i.e (layoutStaticContent + recyclerview content) such that there is only 1 scrollview? I also tried replacing scrollview with Nestedscrollview but no success.

推荐答案

使用 android.support.v4.widget.NestedScrollView 然后在两个布局中NestedScrollView

Use the android.support.v4.widget.NestedScrollView then inside both layout NestedScrollView

这篇关于滚动视图内的 Recyclerview- 如何滚动整个内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆