【问题标题】:Using Recycler view inside Sticky Scroll view not working在 Sticky Scroll 视图中使用 Recycler 视图不起作用
【发布时间】:2017-10-09 21:29:08
【问题描述】:

我有一个要求,我需要编写一个屏幕,该屏幕顶部有一个信息视图,底部有两个选项卡。 View pager 有两个标签,里面有 Recycler View。

每当用户向上滚动时,View 寻呼机应该保持不变,然后其中的回收器视图应该开始滚动。为了实现这一点,我为顶部和底部创建了两个单独的片段,并像这样编写了 xml。

<com.citi.mobile.dashboard.views.StickyScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/core_color_FFFFFF_white">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <include
        android:id="@+id/title_id"
        layout="@layout/app_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <FrameLayout
        android:id="@+id/top_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </FrameLayout>


    <FrameLayout
        android:id="@+id/bottom_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:tag="sticky">
    </FrameLayout>

</LinearLayout>

在底部容器中,我有一个 View Pager。

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 xmlns:custom="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:gravity="center_horizontal"
 android:orientation="vertical">

<android.support.design.widget.TabLayout
    android:id="@+id/TransTabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:tabGravity="fill"
    app:tabIndicatorColor="@color/core_color_0077bb_blue"
    app:tabMode="fixed"
    app:tabSelectedTextColor="@color/core_color_0077bb_blue"
    app:tabTextAppearance="@style/ledgerTabLayoutTextAppearance"
    app:tabTextColor="@color/core_color_666666_grey"
    custom:typefaceName="Roboto-Medium" />

<android.support.v4.view.ViewPager 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/transaction_pager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


</android.support.v4.view.ViewPager>

这有两个选项卡,每个选项卡里面都有一个回收站视图。当我运行它时,父滚动视图停止工作,只有 recyclerview 滚动有效。

【问题讨论】:

    标签: android scroll android-recyclerview


    【解决方案1】:

    尝试将android:nestedScrollingEnabled="false" 添加到您的xml 中的recyclerview。

    【讨论】:

    • 已经试过了......它只是让回收站视图修复了它。整个屏幕停止滚动
    猜你喜欢
    • 2020-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多