简体   繁体   中英

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. 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). 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?

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

app:layout_behavior="@string/appbar_scrolling_view_behavior"

in the layout that holds the fragments (in my case the viewpager)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM