I have a [PDFView][1]
as the direct child of a CoordinatorLayout
as in:
I tried to add app:layout_behavior="@string/appbar_scrolling_view_behavior"
to the PDFView
but it's not compatible so it isn't triggering any scroll behavior on the Toolbar
.
The Toolbar
has app:layout_scrollFlags="scroll|enterAlways|snap"
and I know it works because I already tested it with a NestedScrollView
instead of the PDFView
.
So I want to achieve this programatically, but I can't find any documentation on how to let the CoordinatorLayout
know there's a scroll going on and it should animate the Toolbar
going away.
How can I trigger this behavior programatically? The PDFView
has a ScrollListner
I just don't know how to connect it to the CoordinatorLayout
.
First the PDF view does not implement NestedScrollingChild2 , so you need to implement it. After implementing it , you have to implement five methods. Also create an instance NestedScrollingChildHelper and delegate the implemented methods to this instance.
View subclasses should instantiate a final instance of this class as a field at construction. For each View method that has a matching method signature in this class, delegate the operation to the helper instance in an overridden method implementation. This implements the standard framework policy for nested scrolling.
Let me know if it works.
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.