I got a linear layout that I want to move up when a Snackbar appears.
I saw many examples how to do this with FloatingButton, but what about a regular view?
I got a linear layout that I want to move up when a Snackbar appears.
I saw many examples how to do this with FloatingButton, but what about a regular view?
Based on @Travis Castillo answer. Fixed problems such as :
So here is fixed code for MoveUpwardBehavior Class :
This codes pushes up what user sees on screen and besides user have access to all objects in your layout while SnackBar is showing.
If you want the SnackBar cover the objects instead of pushing and besides user do have access to all objects, then you need to change method onDependentViewChanged :
and method onDependentViewRemoved :
Unfortunately you will lose animation when user swipe to remove SnackBar. And you have to use ValueAnimator class to make animation for padding changes that makes some conflict here and you have to debug them.
https://developer.android.com/reference/android/animation/ValueAnimator.html
Any comment about animation for swipe to remove SnackBar appreciated.
If you can skip that animation then you can use it.
Anyhow, i recommend first type.