[英]Scroll Activity Toolbar off screen scrolling Recyclerview in fragment
I have an activity that hosts 2 fragments, I am currently using a coordinator layout in both fragments with appbarlayout and toolbar layout, I have set it up this way to scroll the toolbar off screen with my recyclerview. 我有一个活动,其中包含2个片段,我目前在两个片段中都使用带有appbarlayout和工具栏布局的协调器布局,我已通过这种方式进行了设置,以使用recyclerview在屏幕上滚动工具栏。 This has been causing my layout issues as I've posted here So I am looking to change my approach. 正如我在此处发布的那样,这一直导致我的布局问题,因此我希望更改自己的方法。 If I can the activity will host the tool bar/app bar layout in a coordinator layout. 如果可以,该活动将在协调器布局中托管工具栏/应用程序栏布局。
The problem with this approach is that the 2 fragments have recyclerviews with views at the bottom (buttons). 这种方法的问题在于,这两个片段的recyclerviews的视图底部(按钮)。 So I'm wondering if it's possible to transfer the scroll from the fragment recyclerview by setting the appbehaviour
while maintaining the position of the buttons on the bottom? 因此,我想知道是否可以通过设置appbehaviour
并同时保持底部按钮的位置来从片段回收appbehaviour
转移滚动条?
Any help on this would be appreciated as I've spent days trying to figure out the alternative approach linked above. 由于我花了数天时间试图找出上面链接的替代方法,因此对此有所帮助。
Thanks 谢谢
Yes it's possible, I'm doing this in an activity with a ViewPager, you just need to add 是的,有可能,我正在使用ViewPager在活动中进行此操作,您只需要添加
app:layout_behavior="@string/appbar_scrolling_view_behavior"
in the layout that holds the fragments (in my case the viewpager) 在保存片段的布局中(在我的情况下是viewpager)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.