Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make BottomNavigationView Menu in Uppercase?

I want to make BottomNavigationView Menu in UpperCase, How can i do that without using 3rd party library?

Here is my xml code:

<android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@android:color/white"
        android:foreground="?attr/selectableItemBackground"
        app:itemIconTint="@color/bottom_nav_color"
        app:itemTextColor="@color/bottom_nav_color"
        app:menu="@menu/navigation" />

And navigation.xml as follows:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/home_icon"
        android:title="@string/title_home"
        />

    <item
        android:id="@+id/navigation_deals"
        android:icon="@drawable/ic_deals"
        android:title="@string/deals" />

    <item
        android:id="@+id/navigation_myBookings"
        android:icon="@drawable/ic_my_bookings"
        android:title="@string/title_my_bookings" />

   <item
        android:id="@+id/navigation_more"
        android:icon="@drawable/ic_more"
        android:title="@string/title_more" />
</menu>
like image 389
Karan Kalsi Avatar asked Jul 17 '18 09:07

Karan Kalsi


People also ask

How to create Bottom Menu in Android Studio?

To create a Menu, first, create a Menu Directory by clicking on the app -> res(right-click) -> New -> Android Resource Directory and select Menu in the Resource Type. To create a Menu Resource File , click on the app -> res -> menu(right-click) -> New -> Menu Resource File and name it bottom_nav_menu.

How do I add more than 5 items in BottomNavigationView?

Create a menu resource with up to 5 navigation targets (BottomNavigationView does not support more than 5 items). Secondly, Having 5 or more items in BottomNavigation is a bad design in terms of User Experience. Even 4 is a stretch. If you need more than 5 items, BottomNavigation is not suitable for you.

How do I use the bottom navigation view?

BottomNavigationView makes it easy for users to explore and switch between top-level views with a single tap. There should be a minimum of 3 top-level views and a maximum of 5. If Destinations are more than 5 then use the Navigation Drawer. When the user taps on the icon it will change the top-level view accordingly.


1 Answers

Try this

Create a style like this BottomNavigationViewStyle

<style name="BottomNavigationViewStyle">
    <item name="android:textAllCaps">true</item>
    <item name="android:textSize">15sp</item>
</style>

Than use like this

<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:background="@android:color/white"
    android:foreground="?attr/selectableItemBackground"
    app:menu="@menu/navigation"
    app:theme="@style/BottomNavigationViewStyle" />

OUTPUT

enter image description here

like image 96
AskNilesh Avatar answered Oct 10 '22 22:10

AskNilesh