BottomBar icon indicating copy to clipboard operation
BottomBar copied to clipboard

Layout completely broken

Open chrjsorg opened this issue 10 years ago • 12 comments

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.

chrjsorg avatar Apr 04 '16 10:04 chrjsorg

How are you using it in Java?

roughike avatar Apr 04 '16 13:04 roughike

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();

chrjsorg avatar Apr 04 '16 13:04 chrjsorg

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

roughike avatar Apr 04 '16 13:04 roughike

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.

chrjsorg avatar Apr 04 '16 13:04 chrjsorg

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 avatar Apr 04 '16 14:04 roughike

Try with the new 1.2.8. version.

roughike avatar Apr 04 '16 14:04 roughike

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.

chrjsorg avatar Apr 04 '16 15:04 chrjsorg

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

roughike avatar Apr 04 '16 15:04 roughike

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..

chrjsorg avatar Apr 04 '16 15:04 chrjsorg

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...

cyberjaime45 avatar Apr 04 '16 15:04 cyberjaime45

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. :)

chrjsorg avatar Apr 12 '16 10:04 chrjsorg

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!.

andrette07 avatar Sep 21 '16 16:09 andrette07