AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

后端 未结 1 1157
[愿得一人]
[愿得一人] 2021-02-05 17:27

I met a lot of issues related with my problem but nobody I found wanted the behaviour I\'m looking for.

I want a view pager with tabs and app bar, when the contained fra

相关标签:
1条回答
  • 2021-02-05 17:44

    If you don't want parallax effect, you don't need to use CollapsingToolbarLayout.

    Most important configuration:

    In Toolbar, set app:layout_scrollFlags="scroll|enterAlways".

    In ViewPager, set app:layout_behavior="@string/appbar_scrolling_view_behavior".

    And layout should look like this:

    <android.support.design.widget.CoordinatorLayout>
    
        <android.support.design.widget.AppBarLayout>
    
            <android.support.v7.widget.Toolbar/>
    
            <android.support.design.widget.TabLayout/>
    
        </android.support.design.widget.AppBarLayout>
    
        <android.support.v4.view.ViewPager/>
    
        <android.support.design.widget.FloatingActionButton/>
    
    </android.support.design.widget.CoordinatorLayout>
    

    Move ProgressWheel out of your SwipeRefreshLayout to fix your problem that SwipeRefreshLayout can't refresh.

    0 讨论(0)
提交回复
热议问题