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

Layout completely broken #126

Closed
chrjsorg opened this issue Apr 4, 2016 · 12 comments
Closed

Layout completely broken #126

chrjsorg opened this issue Apr 4, 2016 · 12 comments
Labels

Comments

@chrjsorg
Copy link

chrjsorg commented Apr 4, 2016

Do you have any idea how this layout is possible?
http://i.imgur.com/Rn2kCOC.png

This is the layout xml:
https://gist.github.com/chrjsorg/83e5f11af0676afc7fef67e508a656fe

I tried attach() and attachShy() with the CoordinatorLayout + ScollLayout (null) and I'm calling .noTopOffset()

It happens on my Nexus 5X. On the emulator its looking fine.

@roughike
Copy link
Owner

roughike commented Apr 4, 2016

How are you using it in Java?

@chrjsorg
Copy link
Author

chrjsorg commented Apr 4, 2016

I tried multiple things (not all at once obviously, all with the same result)

bottomBar = BottomBar.attach(this, savedInstanceState) 
bottomBar = BottomBar.attachShy((CoordinatorLayout) findViewById(R.id.coordinatorLayout_main_appBar), null, savedInstanceState));
bottomBar = BottomBar.attach(findViewById(R.id.coordinatorLayout_main_appBar), savedInstanceState));
bottomBar.noTopOffset();

@roughike
Copy link
Owner

roughike commented Apr 4, 2016

Are you sure that's all? You're not using setDefaultTabPosition(2) or selectTabAtPosition() methods?

@chrjsorg
Copy link
Author

chrjsorg commented Apr 4, 2016

Its complex...
I'm calling all of the above + setDefaultTabPosition(my_synced_tab_position) onResume. I dont have any savedInstanceState (its always null) while attaching. And I only call attach when its not called previously.

I have multiple Activities using its own BottomBar, so I try so synchronize the selected bottom tabs and have to select it manually on onResume.

@roughike
Copy link
Owner

roughike commented Apr 4, 2016

I'm fixing this as we speak. The issue is related to setDefaultTabPosition / selectTabAtPosition methods, which also update the widths of the tabs if the resize animation is enabled.

@roughike roughike added the bug label Apr 4, 2016
@roughike
Copy link
Owner

roughike commented Apr 4, 2016

Try with the new 1.2.8. version.

@chrjsorg
Copy link
Author

chrjsorg commented Apr 4, 2016

It looks better now. But its still not perfect. Maybe because I can't call attach with the savedInstanceState? :/

http://i.imgur.com/aJwXdtZ.png

http://i.imgur.com/jfScTTI.png

Also, if you take a look at the second screenshot, it seems that the middle item is "still somehow selected" according to the padding etc.

@roughike
Copy link
Owner

roughike commented Apr 4, 2016

Is there a reason why you don't use one Activity with multiple Fragments instead of multiple Activities with multiple BottomBars?

@chrjsorg
Copy link
Author

chrjsorg commented Apr 4, 2016

Unfortunately I can't change that for the moment. Maybe it will be required anyway since the animations will be broken anyway (probably).
I know our use case isn't the best..

@cyberjaime45
Copy link

I had the same the same issue. I though it was due to my device was running Android N. But then I used a marshmallow device, same thing. The layout gets mess up when I added this to resource file fitsSystemWindows=true. So I removed, and added some extra top padding to custom toolbar. I also added mBottomBar.noTopOffset() before mBottomBar.setItemsFromMenu(.......

Its kind hacky but it works just fine...

@chrjsorg
Copy link
Author

I'll close it. We switched to 1 Activity with multiple fragments, since there is no way to imitate the behavior completely (animations etc.) - not your fault. :)

@andrette07
Copy link

Hi everyone, I am trying to call mButtomBar.attach() but the attach() is not working I don't know why, maybe you can help me please!.

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

No branches or pull requests

4 participants