2017-10-09 73 views
0

我有一個需求,我需要編寫一個屏幕,其中頂部有一個信息視圖,並在底部有兩個選項卡查看尋呼機。查看傳呼機有兩個帶Recycler View的標籤。在粘滯滾動視圖中使用Recycler視圖不工作

無論何時用戶向上滾動查看傳呼機,然後裏面的回收站視圖都應該開始滾動。爲了達到這個目的,我爲頂部和底部創建了兩個單獨的片段,並像這樣寫了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> 

裏面的底部容器我有一個觀點尋呼機。

<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滾動工作。

回答

0

嘗試在您的xml中將android:nestedScrollingEnabled="false"添加到recyclerview中。

+0

已經嘗試過......它只是使回收視圖固定多數民衆贊成它。整個屏幕停止滾動 – Ashim