We mainly use the toolbar menu with the icon, sometimes we also use the icon / text together. The icon along with the text is displayed horizontally, as shown in the figure below.

This usually happens, but I want to show the menu icon / text vertically, as shown below.

I made an xml layout with this xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:orientation="horizontal"
android:padding="@dimen/default_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/bg_timeline"
android:layout_weight="1"
android:gravity="center"
android:text="@string/label_timeline" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/default_margin"
android:drawableTop="@drawable/ic_about_large"
android:layout_weight="1"
android:gravity="center"
android:text="@string/label_about" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_achivement_active"
android:layout_marginLeft="@dimen/default_margin"
android:layout_weight="1"
android:gravity="center"
android:text="@string/label_achievements" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_more"
android:background="?selectableItemBackground"
android:gravity="center"
android:layout_marginLeft="@dimen/default_margin"
android:layout_weight="1"
android:text="@string/label_more" />
</LinearLayout>
My question is how can I implement a toolbar / action bar when a menu item is placed as Text under each icon in general. Is there any way to do this?
source
share