Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide bottom bar on scroll #7

Closed
FabianTerhorst opened this issue Mar 17, 2016 · 5 comments
Closed

hide bottom bar on scroll #7

FabianTerhorst opened this issue Mar 17, 2016 · 5 comments

Comments

@FabianTerhorst
Copy link

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
Copy link
Owner

@FabianTerhorst
Will do, and thanks for the link.

@NikolaDespotoski
Copy link
Contributor

@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
Copy link
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
Copy link
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.

@mehrdad-shokri
Copy link

@NikolaDespotoski, @roughike Thnaks for exmplanations.
As you can see the navigation bottoms don't go transparent on scroll to down.
Do you know any way to achieve this?
I've been able to achive this result, but bottom bar is hiding behind navigation bottom instead of just hiding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants