Android - How to change bottom navigation bar text's font family

how to change bottom navigation bar icon color
custom bottom navigation bar android
curved bottom navigation bar android
material bottom navigation android github
change bottom navigation text size android
how to fix bottom navigation bar in android
custom bottom navigation view android example
bottom navigation bar android not showing

I have created a bottom bar navigation in my android page. But now I want to apply the custom font-family in bottom navigation texts.

This is the bottom navigation code in .xml file:

<android.support.design.widget.BottomNavigationView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/bottomNavView_Bar"
            android:background="@drawable/white_grey_border_top"
            app:menu="@menu/bottom_navigation_menu">
</android.support.design.widget.BottomNavigationView>

Also, code in bottom_navigation_menu.xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      >

    <item
        android:id="@+id/ic_newsfeed"
        android:icon="@drawable/ic_menu_camera"
        android:title="NEWSFEED"
        />

        <item
            android:id="@+id/ic_explorer"
            android:icon="@drawable/ic_home_black_24dp"
            android:title="EXPLORER"
            />
        <item
            android:id="@+id/ic_notify"
            android:icon="@drawable/ic_notifications_black_24dp"
            android:title="NOTIFY"
            />
        <item
            android:id="@+id/ic_more"
            android:icon="@drawable/ic_dashboard_black_24dp"
            android:title="MORE"
            />

</menu>

Help would be appreciated.

Thanks in advance!


add the font file in the res/font/ folder to bundle fonts as resources

then

You can change it using style resources. In your styles.xml:

<style name="Widget.BottomNavigationView" 
    parent="Widget.Design.BottomNavigationView">
    <item name="fontFamily">@font/your_font</item>
</style>

Then apply it as a theme in your view:

<android.support.design.widget.BottomNavigationView
    ...
    android:theme="@style/Widget.BottomNavigationView"
/>

Just checked on my app, it works fine.

reference: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml.html#fonts-in-code

How to change Bottom Navigation Bar text font family in Android, In this android programming source code example, we are going to change bottom navigation bar text font family. You can copy and adopt this source code  In this android programming source code example, we are going to change bottom navigation bar text font family. You can copy and adopt this source code example to your android project without reinventing the wheel. Below is a step by step source code to change bottom navigation bar text font family. activity_main.xml


In your layout:

<com.google.android.material.bottomnavigation.BottomNavigationView
    ...
    app:itemTextAppearanceActive="@style/BottomNavigationViewTextStyle"
    app:itemTextAppearanceInactive="@style/BottomNavigationViewTextStyle"
    ... />

In your styles.xml:

<style name="BottomNavigationViewTextStyle">
    ...
    <item name="android:fontFamily">@font/whatever_font</item>
    ...
</style>

Bottom Navigation, Bottom navigation bars make it easy to explore and switch between top-level is received), the recommended/lightweight alternative is to change the visibility of the Material BottomNavigationView style consists of updated colors, text sizing,​  In this android programming source code example, we are going to change bottom navigation view selected item color in android. You can copy and adopt this source code example to your android project without reinventing the wheel. Below is a step by step source code to change bottom navigation view selected item color in android. activity_main.xml.


This can be done by overriding onLayout method of BottomNavigationView class then using the extended tag. This approach also shows all menu titles and disables shifting.

public final class ExtendedBottomNavigationView extends BottomNavigationView{
    private final Context context;
    private Typeface fontFace = null;

    public ExtendedBottomNavigationView(Context context, AttributeSet attrs){
        super(context, attrs);
        this.context = context;
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom){
        super.onLayout(changed, left, top, right, bottom);
        final ViewGroup bottomMenu = (ViewGroup)getChildAt(0);
        final int bottomMenuChildCount = bottomMenu.getChildCount();
        BottomNavigationItemView item;
        View itemTitle;
        Field shiftingMode;

        if(fontFace == null){
            fontFace = Typeface.createFromAsset(context.getAssets(), context.getString(R.string.VazirBold));
        }
        try {
            //if you want to disable shiftingMode:
            //shiftingMode is a private member variable so you have to get access to it like this:
            shiftingMode = bottomMenu.getClass().getDeclaredField("mShiftingMode");
            shiftingMode.setAccessible(true);
            shiftingMode.setBoolean(bottomMenu, false);
            shiftingMode.setAccessible(false);
        } catch (NoSuchFieldException e){
            e.printStackTrace();
        } catch (IllegalAccessException e){e.printStackTrace();}

        for(int i=0; i<bottomMenuChildCount; i++){
            item = (BottomNavigationItemView)bottomMenu.getChildAt(i);
            //this shows all titles of items
            item.setChecked(true);
            //every BottomNavigationItemView has two children, first is an itemIcon and second is an itemTitle
            itemTitle = item.getChildAt(1);
            //every itemTitle has two children, first is a smallLabel and second is a largeLabel. these two are type of AppCompatTextView
            ((TextView)((BaselineLayout) itemTitle).getChildAt(0)).setTypeface(fontFace, Typeface.BOLD);
            ((TextView)((BaselineLayout) itemTitle).getChildAt(1)).setTypeface(fontFace, Typeface.BOLD);
        }
    }
}

Then use it like this:

<your.package.name.ExtendedBottomNavigationView android:id="@id/bottomMenu" style="@style/bottomMenu"/>

Control Text Size on Android Bottom Navigation, It seems as though my obsession with the Android Bottom Navigation View aka Bottom Tabs will never end! This time I got a question about  The Bottom Navigation bar is a top-level navigation component. It displays three to five destinations, each with an icon and an optional text label.It is an ergonomic component; its bottom


if you have a CustomFont in Asset Folder and you want to set in your bottom navigation use this code

  public class Font extends AppCompatActivity {
        public static void persian_iran_font(final Context context, final View v) {
            try {
                if (v instanceof ViewGroup) {
                    ViewGroup vg = (ViewGroup) v;
                    for (int i = 0; i < vg.getChildCount(); i++) {
                        View child = vg.getChildAt(i);
                        persian_iran_font(context, child);
                    }
                } else if (v instanceof TextView) {
                    ((TextView) v).setTypeface(Typeface.createFromAsset(context.getAssets(), "teshrinarmedium.otf"));
                }
            } catch (Exception e) {
            }
        }
    }

And then use Font Class in your MainActivity Like This

  BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    Font.persian_iran_font(getApplicationContext(), navigation);

Goodluck

Bottom Navigation Views, Bottom navigation provide easy navigation for switching between 3 to 5 the icons that will be displayed in a res/menu/menu_bottom_navigation.xml file: You can change the fill color after importing the vector drawable by modifying the fillColor : <! app:itemTextColor - The text color for the bottom navigation's items' text. It should have an elevation of 8dp. As Snack bars have lower elevation (6dp), they appear behind the bottom navigation bar. The active icon should be tinted with the app's primary color. Black or white color is to be used if the bottom navigation bar is already colored. If the view is in focus, that view’s icon and text label are to be displayed.


Per https://material.io/develop/android/components/bottom-navigation-view/, just set a fontFamily item for the TextAppearance.MaterialComponents.Caption style and it’ll Just Work. com.google.android.material.bottomnavigation.BottomNavigationView will use this by default.

Just know other components that rely on TextAppearance.MaterialComponents.Caption will get changed as well, but this might be desirable.

<style name="TextAppearance.MaterialComponents.Caption" parent="AppMaterialComponentsTheme">
        <item name="fontFamily">@font/example</item>
</style>

Long text cutting off in BottomNavigationView · Issue #139 · material , Setup bottom navigation view with 5 menu items with titles as: "Starseite", "​Suchen", BottomNavigationView android:id="@+id/home.navigation" Also, we can override these dimens to change the text sizes of the labels in  In Android, there are many options for making navigation easy in your application for the user. Bottom Navigation Bar is one of them. Bottom Navigation Bar always stays at the bottom of your application and provides navigation between the views of your application. So in this Bottom Navigation Android Example, we will see how we combine the


How to add a Bottom Navigation Bar in Android - Suragch, The only special thing we have added to the layout is the BottomNavigationView . To change the color of the icon and text when it is clicked, you can use a selector​  BottomNavigationView creates bottom navigation bars, making it easy to explore and switch between top-level content views with a single tap. This pattern can be used when you have between 3 and 5 top-level destinations to navigate to. Create a menu resource with up to 5 navigation targets ( BottomNavigationView does not support more than 5


How to Code a Bottom Navigation Bar for an Android App, Bottom navigation bars make it easy to explore and switch between top-level views in a single tap. An example of a popular app that implements the bottom navigation bar is the Google+ Android app from Google, of the menu item text. the corresponding Fragment and also change the action bar title. The following full example shows how to make a Bottom Navigation Bar like the image below. Add the design support library Add this line to your app’s build.grade file next to the other support


Some tips to a better experience working with Android's , BottomNavigationView creates bottom navigation bars, making it easy to But if we need to change title's font or text size, which surely we'll