[英]How to use AppBarLayout's lift-on-scroll with ViewPager + RecyclerView?
I have an activity layout that's like this:我有一个这样的活动布局:
<CoordinatorLayout>
<AppBarLayout>
<Toolbar />
<TabLayout />
</AppBarLayout>
<ViewPager />
</CoordinatorLayout>
Then, in the activity, the viewpager is populated with three fragments.然后,在活动中,viewpager 填充了三个片段。 Each of these fragments has a layout like this:
这些片段中的每一个都有这样的布局:
<FrameLayout>
<FrameLayout>
<RecyclerView />
<Other views />
</FrameLayout>
<Other views />
</FrameLayout>
Now, in other views where RecyclerView
is not used for the content, the lift-on-scroll works just fine (for instance, when using NestedScrollView
instead of RecyclerView
).现在,在
RecyclerView
不用于内容的其他视图中,提升滚动工作得很好(例如,当使用NestedScrollView
而不是RecyclerView
)。 However, with RecyclerView
it doesn't work.但是,使用
RecyclerView
它不起作用。 How should it be configured to make it work?它应该如何配置以使其工作?
在应用栏上添加这个:
app:liftOnScroll="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.