I have a question for Android Coordinate Lyaout Behavior.

Asked 2 years ago, Updated 2 years ago, 23 views

<android.support.design.widget.CoordinatorLayout>
   <android.support.design.widget.AppBarLayout>
   ...
   </android.support.design.widget.AppBarLayout>

   <android.support.v7.widget.RecyclerView
   app:layout_behavior="@string/appbar_scrolling_view_behavior"
   />

   <android.support.design.widget.CoordinatorLayout>
      <android.support.design.widget.FloatingActionButton
      app:layout_behavior="kr.co.kbell.smartled.behavior.ScrollFABBehavior"/>
   </android.support.design.widget.CoordinatorLayout>

</android.support.design.widget.CoordinatorLayout>

I'm currently using one more Coordinator Layout inside Coordinator Layout In it, we applied ScrollFABehavior (CustomBehavior) to show(), hide() FloatingActionButton whenever we scroll through RecyclerView.

The problem is that when FloatingActionButton is in the top CoordinatorLayout, Behavior's onNestedScroll callback method is invoked to hide, show The event does not occur when you are in the second Coordinator Layout.

Bottom Navigation View is being used as a fixed one. How do I operate the Behavior of Floating Action Button?

android

2022-09-21 18:48

1 Answers

To use Coordinator Layout superimposed on an already existing CoordinatorLayout, customization is required by implementing the NestedScrollingChild interface. In a typical situation, events are passed on and "consumed" to those in the direct child hierarchy.

I'm attaching a link to help you. https://stackoverflow.com/questions/34181372/coordinatorlayout-inside-another-coordinatorlayout


2022-09-21 18:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.