Fixed fabs disappearing on scroll.
This commit is contained in:
parent
2fcbf0bbc6
commit
4cdec667e5
1 changed files with 7 additions and 1 deletions
|
@ -41,7 +41,13 @@ class ScrollAwareFABBehavior() : FloatingActionButton.Behavior() {
|
||||||
dyUnconsumed: Int) {
|
dyUnconsumed: Int) {
|
||||||
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed)
|
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed)
|
||||||
if (dyConsumed > 0 && child!!.visibility == View.VISIBLE) {
|
if (dyConsumed > 0 && child!!.visibility == View.VISIBLE) {
|
||||||
child.hide()
|
// see: https://stackoverflow.com/a/42082313/5640587
|
||||||
|
child.hide(object : FloatingActionButton.OnVisibilityChangedListener() {
|
||||||
|
override fun onHidden(fab: FloatingActionButton?) {
|
||||||
|
super.onHidden(fab)
|
||||||
|
fab!!.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
})
|
||||||
} else if (dyConsumed < 0 && child!!.visibility != View.VISIBLE) {
|
} else if (dyConsumed < 0 && child!!.visibility != View.VISIBLE) {
|
||||||
child.show()
|
child.show()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue