Skip to content

Instantly share code, notes, and snippets.


Bitsy Darel bitsydarel

View GitHub Profile
bitsydarel / BottomNavigationViewBehavior.kt
Created Feb 15, 2018
Layout behavior for Bottom Navigation View to hide and show on scroll. Root ViewGroup should be CoordinatorLayout.
View BottomNavigationViewBehavior.kt
class BottomNavigationViewBehaviour(context: Context, attrs: AttributeSet) : CoordinatorLayout.Behavior<BottomNavigationView>(context, attrs) {
private var height: Int = 0
override fun onLayoutChild(parent: CoordinatorLayout?, child: BottomNavigationView?, layoutDirection: Int): Boolean {
height = child!!.height
return super.onLayoutChild(parent, child, layoutDirection)
override fun onStartNestedScroll(coordinatorLayout: CoordinatorLayout, child: BottomNavigationView, directTargetChild: View, target: View, axes: Int, type: Int): Boolean {
You can’t perform that action at this time.