0

Is there a way to simulate a bottom bar on Android as in iOS?

When I'm inside a tab, if I need an intent to another activity, I want to maintain the bottom bar visible and make a smooth transition, keeping the bottom bar aways visible. Maybe it is possible to accomplish that using CoordinatorLayout?

Thank you.

Maurício Giordano
  • 3,116
  • 4
  • 32
  • 60
  • That would be poor design in Android. Figure out what Android navigation this translates to, and port into that. – 323go Mar 07 '16 at 23:34
  • 2
    Why would you attempt to bring an iOS paradigm into Android? You'd be better off sticking to the Android conventions when writing an Android app. – Francesc Mar 07 '16 at 23:35
  • 1
    @Francesc That actually doesn't matter. Anyway, tell me why Google Plus uses iOS conventions... – Maurício Giordano Mar 07 '16 at 23:39
  • If you want to do it, then use a ToolBar and anchor it at the bottom of your layout. – Francesc Mar 07 '16 at 23:40
  • @Francesc Yeah, that works, but my question is when I click on a button inside one of these fragments, it will open a new activity. I need to keep the bottom bar visible in the transition, to simulate iOS behavior. – Maurício Giordano Mar 07 '16 at 23:42
  • 1
    "That actually doesn't matter." -- that actually *does* matter. Those of us who take pride in their craft are unwilling to help you build a poor app. – 323go Mar 07 '16 at 23:46
  • @323go I'm sorry, but that doesn't matter at all. I'm not asking for design advices or anything like that, I'm asking for suggestions and help solving my problem. Also, by solving my problem, others may use the solution to help on their own problems. – Maurício Giordano Mar 07 '16 at 23:48
  • 1
    You can't do it with multiple activities. If you are intent on going down this rabbit hole, you will have to use a single activity and keep switching fragments above the toolbar. – Francesc Mar 08 '16 at 00:02
  • First of all, this question is not properly asked. You have no code representing what you have tried so far, so asking for us help at this point is a little vague. Take the advice and stick to Android paradigms.. with that being said if you still want to avoid that then use a Layout that can support stacking other views. Stack a FrameLayout on top with a Toolbar (or LinearLayout with horizontal orientaiton) below it. Then swap fragments in place of the FrameLayout using the support fragment manager. Other than that, you can't keep a view fixed and still swap Activities.. – Lucas Crawford Mar 08 '16 at 00:30
  • 1
    @LucasCrawford Well https://www.google.com/design/spec/components/bottom-navigation.html#bottom-navigation-style – Maurício Giordano Mar 15 '16 at 15:35
  • see this: http://stackoverflow.com/questions/36019986/which-view-should-be-used-for-new-material-design-bottom-navigation/42119958#42119958 – Fartab Feb 08 '17 at 17:47

1 Answers1

0

From v25 of design support library (compile 'com.android.support:design:25.0.0') You can use BottomNavigationView.

  <android.support.design.widget.BottomNavigationView
       xmlns:design="http://schemas.android.com/apk/res-auto"
        android:layout_gravity="bottom"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        design:menu="@menu/bottom_menu" />

Here is more about using this.

marioosh
  • 27,328
  • 49
  • 143
  • 192