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>
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With