简体   繁体   English

滚动“活动工具栏”,在屏幕外滚动片段中的Recyclerview

[英]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.

相关问题 通过在Fragment中滚动recyclerview来隐藏活动中的工具栏? - Hide toolbar in activity by scrolling a recyclerview inside the Fragment? 在片段内而不是活动内使用recyclerview时,在滚动条上隐藏工具栏 - Hide toolbar on scroll when the using a recyclerview inside a Fragment instead of an Activity 在嵌套片段中滚动RecyclerView时隐藏工具栏 - Hiding Toolbar when Scrolling a RecyclerView in nested Fragment 隐藏工具栏滚动与片段内的recyclerview - Hiding Toolbar on scroll with recyclerview inside fragment 无法使用片段滚动带有 recyclerview 的折叠工具栏 - Unable to scroll collapsing toolbar with recyclerview using fragment 如何通过滚动导航组件片段来滚动 Activity 的工具栏 - How to scroll away Activity's toolbar by scrolling its Navigation Component fragment CoordinatorLayout,AppBarLayout和ToolBar - 工具栏不会滚动屏幕 - CoordinatorLayout, AppBarLayout and ToolBar - Toolbar doesn't scroll off the screen 无法滚动 RecyclerView,尝试在滚动时隐藏工具栏 - Can't scroll RecyclerView, when try to hide toolbar on scrolling 如果我向下滚动片段中的recyclerView,如何自动隐藏工具栏? - How to hide toolbar automatically if I scroll down the recyclerView inside a fragment? RecyclerView不会在折叠工具栏中滚动 - RecyclerView not scrolling in Collapsing Toolbar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM