2016-02-21 71 views
1
<android.support.design.widget.CoordinatorLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <! -- Your Scrollable View --> 
    <android.support.v7.widget.RecyclerView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

    <android.support.design.widget.AppBarLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
    <android.support.v7.widget.Toolbar 
        ... 
        app:layout_scrollFlags="scroll|enterAlways"> 

     <android.support.design.widget.TabLayout 
        ... 
        app:layout_scrollFlags="scroll|enterAlways"> 
    </android.support.design.widget.AppBarLayout> 
</android.support.design.widget.CoordinatorLayout> 

當我觸摸(屏幕上)scoll的recyclerview滾動行爲工作正常,但是當我滾動recyclerview編程滾動RecyclerView手動不更新CoordinatorLayout,同時通過觸摸滾動更新它CoordinatorLayout

LinearLayoutManager layoutManager = ((LinearLayoutManager) getLayoutManager()); 
     layoutManager.scrollToPositionWithOffset(spanCount * exactItemPos/mScrollPosState.rowHeight, 
       -(exactItemPos % mScrollPosState.rowHeight)); 

的recyclerview滾動欄不

回答

0

你可以把

appBarLayout.setExpanded(false); 

之前你做scrollToPositionWithOffset

+0

我想scrollToPositionWithOffset更改AppBarLayout,就好像用戶正在滾動,你明白我的意思嗎? – user3531883

相關問題