0

is it possible to create a menu in Android app like this ?

Screen Mockup

Menu has five differend items here. I need the menu to always be visible. I couldn't find a way to do this. Is there any way, or i must create everything by myself ?

BuddhiP
  • 6,231
  • 5
  • 36
  • 56
Lauris01
  • 283
  • 1
  • 4
  • 19
  • Google tab and FragmentTabHost. – Héctor Aug 08 '14 at 07:41
  • It's possible, look at [this question](http://stackoverflow.com/questions/2395661/android-tabs-at-the-bottom). However, take a note on [Pure Android](http://developer.android.com/design/patterns/pure-android.html). – Andrew T. Aug 08 '14 at 07:50
  • That isn't a menu - it's a tab bar (host) at the bottom of the screen. This has always been considered a bad design for Android apps and tabs should go to the top. Even better use a top Action Bar if you want to conform to Android design guidelines. – Squonk Aug 08 '14 at 07:51

2 Answers2

3

Using that kind of navigation is not advised by Google in their design guidelines. So please revise your wireframes.

You should be using an ActionBar or a Navigation Drawer for navigation.

I suggest you read up on the navigation patters specified by Google. You can find them here. Specifically the App Structure, Navigation, ActionBar and Navigation Drawer parts.

The Android Documentation is very extended and has a lot of samples. Good luck

UPDATE: The ActionBar of course. See here for more info.

Jelle
  • 919
  • 9
  • 16
0

You can use TabHost in android, but unfortunately advisable not to use.

What you can do is to create your own bottom tab interface in an activity and replace the fragment above your tab

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    tools:context="com.webwerks.marlowwindowshopper.BaseTabActivity" >

    <FrameLayout
        android:id="@+id/main_frag_container"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="0.92" >
    </FrameLayout>

    <LinearLayout
        android:id="@+id/tab_layout"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@android:color/white"
        android:orientation="horizontal"
        android:padding="3dp" >

        <Button
            android:id="@+id/btn_shop_venue"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@null"
            android:drawableTop="@drawable/selector_btn_shops_venues"
            android:gravity="bottom|center_horizontal"
            android:singleLine="false"
            android:text="Shops &amp; venues"
            android:textSize="12sp" />

        <Button
            android:id="@+id/btn_events"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@null"
            android:drawableTop="@drawable/selector_btn_events"
            android:gravity="bottom|center_horizontal"
            android:text="Events"
            android:textSize="12sp" />

        <Button
            android:id="@+id/btn_snap_item"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@null"
            android:drawableTop="@drawable/selector_btn_snap_item"
            android:gravity="bottom|center_horizontal"
            android:text="Snap an item"
            android:textSize="12sp" />

        <Button
            android:id="@+id/btn_my_list"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="@null"
            android:drawableTop="@drawable/selector_btn_my_list"
            android:gravity="bottom|center_horizontal"
            android:text="My list"
            android:textSize="12sp" />
    </LinearLayout>

</LinearLayout>

Now replace/add your fragment('main_frag_container' in my case) according to your button click.

joecizac
  • 1,077
  • 2
  • 13
  • 14
  • Hmm this seems bit logical to me. – Manoj Aug 08 '14 at 07:44
  • `TabHost` is *NOT* deprecated. Look at the docs and try to find anywhere that says it or any of its methods are deprecated. https://developer.android.com/reference/android/widget/TabHost.html – Squonk Aug 08 '14 at 07:48
  • Not 'actually' deprecated, but advised not to use according to the design guidelines. – Jelle Aug 08 '14 at 07:55
  • oops! sorry guys...I have updated my answer. Thanks from pointing that out :) – joecizac Aug 08 '14 at 07:57
  • @Jelle : No. The use of tabs at the bottom of the screen goes against Android Design Guidelines *NOT* the use of `TabHost`. Take a look at the v4 and v13 support libraries `TabHostFragment` classes - they both directly extend `TabHost` which means it would also be advisable not to use them. If you can find a link to Design Guidelines docs which say otherwise, let me know. – Squonk Aug 08 '14 at 08:14
  • You're right. But the fact that it's never used in the samples, says a lot as well. On topic: If you want tabs, you should use the ActionBar-feature for that. http://developer.android.com/design/building-blocks/tabs.html – Jelle Aug 08 '14 at 08:22
  • @Jelle : I use both an `ActionBar` and tabs in a `Fragment`. See http://www.ndroid.org.uk - the days of week tabs are implemented with a `TabHost` and switch the TV Guide `ListFragment` below - there was no other way of doing it. The `ActionBar` has action tabs to the left and an options menu to the right. As for an example of `TabHostFragment` see the docs for `TabActivity` (which *IS* deprecated) https://developer.android.com/reference/android/app/TabActivity.html – Squonk Aug 08 '14 at 08:36