Skip to content

hide bottom bar on scroll #7

Closed
FabianTerhorst opened this Issue · 4 comments

3 participants

@FabianTerhorst

There is a useful medium article how to hide the bottom bar when scrolling down. Maybe you can implement this feature to this library. https://medium.com/@nullthemall/bottom-navigation-behavior-388b9b206667#.7ufpfhq3a

@roughike
Owner

@FabianTerhorst
Will do, and thanks for the link.

@NikolaDespotoski

@FabianTerhorst @roughike Hi guys, I'm the author of the mentioned behavior and article. I forked the repo and tried to add it to the lib. It wont work because of two things:

First: BottomBar is attached to content view which is FrameLayout not CoordinatorLayout
Second: The content is always above it, not behind it. Which means that it will leave empty (window background color will be visible) space when the BottomBar is hidden.

I assume this is for favoring the SnackBars, but they should be handled by behavior (lol, mine doesnt care about snackbars)

Also the content view should be given a proper padding in order the bottom bar and content view do not overlap. This would be applicable if the BottomBar is not attached directly to the android.R.id.content.

IMHO, the BottomBar should not be added directly to the content view, it should work like any other view.Basically, BottomBar should work as ViewGroup out of the box. This is totally subjective opinion and should not be taken as true.

Possible solution is checking if the child at 0 is CoordinatorLayout and avoid removing it in attach method. I mean overall rearrangement of the views. This needs tremendous efforts to be invested, because we have a unknown number of child inside CoordinatorLayout add padding so the content does not overlap.

What I have tried:

Binding the behavior whenever LayoutParams are added to the BottomBar.

I'm subscribing this issue for any comments.

@roughike
Owner

@NikolaDespotoski
Huge thanks for your awesome gist! I modified your code a bit and although it took a while, I finally got it to work.

This is now supported starting from version 1.1.4. See here for instructions.

Demo:

@roughike roughike closed this
@roughike
Owner

@NikolaDespotoski

IMHO, the BottomBar should not be added directly to the content view, it should work like any other view.Basically, BottomBar should work as ViewGroup out of the box. This is totally subjective opinion and should not be taken as true.

I might make some kind of BottomBarLayout ViewGroup that auto-detects the user's content layout available in the future.

Currently there shouldn't be nothing that can't be done with the BottomBar just because it can't be used by XML. I'm busting my ass implementing everything in the Material Design spec (and squashing bugs all the time), so the XML usage is low priority ATM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.