0

我已經使用回收站視圖內嵌套的滾動視圖(這是內CoordinatorLayout):嵌套循環器查看滾動發行

 <android.support.v4.widget.NestedScrollView 
      android:id="@+id/scroll" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

       <android.support.v7.widget.RecyclerView 
        android:id="@+id/sections_recycler_view_linearlayout" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical" /> 

      </RelativeLayout> 

     </android.support.v4.widget.NestedScrollView> 

在我加入兒童回收站意見編程方式使用setNestedScrollingEnabled假上述回收的適配器。

我的問題是: 當我滾動子回收站時,一旦它的滾動完成,父回收站就會滾動到頂端,就好像我正在重新設置它的適配器一樣。我沒有添加任何代碼來通知適配器或滾動到最頂級的回收站項目或再次設置適配器。我無法弄清楚這種奇怪行爲的原因。

任何幫助將不勝感激.. !!!

+0

爲什麼你甚至需要這種結構?單個recycleview可以做同樣的事情。 – breakline

+0

因爲我希望家長回收商在兒童回收商水平滾動時垂直滾動。家長回收員已與Collapsable Toolbar一起使用以顯示工具欄動畫,並且將在運行時決定在家長回收者視圖中有多少孩子將在那裏。 – user3492435

+0

即使我刪除了setHasFixedSize,或者即使將其設置爲true或false,但子滾動屏幕仍會停滯。 – user3492435

回答

0

我直到從服務器接收數據時纔在兒童回收器視圖中顯示進度條。一旦我得到數據,我正在填充它。我使用交錯的適配器進行行數爲2的子回收器,因此在數據填充後,我的父母回收器的高度發生了變化。

我使用setHasFixedSize(false)作爲父級回收視圖,因爲它的高度正在改變,直到現在我還沒有看到這個問題。

0

簡單, 添加

android:fillViewport="true" 

您NestedScrollview,你會好到哪裏去。

0

添加到您的父母回收站查看:

android:descendantFocusability="blocksDescendants"