Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to create a bottom toolbar in android.

Sample Toolbar

Looking for a good approach to achieve a similar toolbar. Should I use image buttons ??

like image 520
Ved Agarwal Avatar asked May 05 '15 21:05

Ved Agarwal


People also ask

How do I get the bottom toolbar on Android?

To create a Menu Resource File , click on the app -> res -> menu(right-click) -> New -> Menu Resource File and name it bottom_nav_menu. Now the user can create as many items as he wants in the bottom_nav_menu. xml file. The user also needs to create an icon for each of these items.

What is bottom navigation bar in Android?

Bottom navigation bars make it easy for users to explore and switch between top-level views in a single tap. They should be used when an application has three to five top-level destinations.


1 Answers

<android.support.v7.widget.Toolbar  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/actionbarT"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/thebackgroundimageyouwant"
android:minHeight="?attr/actionBarSize"
app:theme="@style/Base.Theme.AppCompat.CompactMenu" >

    <LinearLayout
        android:id="@+id/toolbarmenucontainer"
        android:layout_width="match_parent"
        android:weightSum="3"
        android:layout_height="match_parent"
        android:orientation="horizontal" >

        <ImageButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="@drawable/preferedbackground"
            android:clickable="true"
            android:scaleType="fitXY"
            android:layout_weight = "1"
            android:src="@drawable/preferredimage" />

         <ImageButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="@drawable/preferedbackground"
            android:clickable="true"
            android:scaleType="fitXY"
            android:layout_weight = "1"
            android:src="@drawable/preferredimage" />

        <ImageButton
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="@drawable/preferedbackground"
            android:clickable="true"
            android:scaleType="fitXY"
            android:layout_weight = "1"
            android:src="@drawable/preferredimage" />

    </LinearLayout>

</android.support.v7.widget.Toolbar>

the idea is they will lay out horizontally like the one you want, also then do not do ToolBar.setTitle() or setnagivation on the ToolBar also you don't have to add optionsMenu to it. so it will be bare like the one you want.

try it and see if it fits your requirement, remember to add the background and image src to the ImageButtons

like image 195
Elltz Avatar answered Oct 22 '22 06:10

Elltz