question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Long text cutting off in BottomNavigationView

See original GitHub issue

Overview

Long texts cut off in BottomNavigationView only when tab is selected. When tab is unselected, it displays the text properly

When tab is unselected (Meine tickets)

screen shot 2018-06-08 at 08 45 31

When tab is selected (Meine tickets)

screen shot 2018-06-08 at 08 45 48

Reproduction steps

  • Setup bottom navigation view with 5 menu items with titles as: “Starseite”, “Suchen”, “Meine Tickets”, “Verkaufen”, “Profil”
<menu
  xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:id="@+id/action_home"
    android:icon="@drawable/tab_home_icon_selector"
    android:title="@string/nav_tab_home"/>

  <item
    android:id="@+id/action_explore"
    android:icon="@drawable/tab_explore_icon_selector"
    android:title="@string/nav_tab_explore"/>

  <item
    android:id="@+id/action_my_tickets"
    android:icon="@drawable/tab_tickets_icon_selector"
    android:title="@string/nav_tab_my_tickets"/>

  <item
    android:id="@+id/action_sell"
    android:icon="@drawable/tab_sell_icon_selector"
    android:title="@string/nav_tab_sell"/>

  <item
    android:id="@+id/action_profile"
    android:icon="@drawable/tab_profile_icon_selector"
    android:title="@string/nav_tab_profile"/>
</menu>
  • View style is:
<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/home.navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:labelVisibilityMode="labeled"
    app:menu="@menu/home"/>

Version number

  • Found in version 1.0.0-alpha3

Operating system and device

  • Found in Nexus 5X emulator running Android Oreo

screen shot 2018-06-08 at 08 55 37

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:15
  • Comments:35 (2 by maintainers)

github_iconTop GitHub Comments

56reactions
ppthakurcommented, Aug 3, 2018

Please add this property in your Xml app:labelVisibilityMode=“selected”

50reactions
dimasdarkcommented, Nov 5, 2018

Use @sagrawal2418 answer:

BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigationView.getChildAt(0);   
 for (int i = 0; i < menuView.getChildCount(); i++) {
        BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
        View activeLabel = item.findViewById(R.id.largeLabel);
        if (activeLabel instanceof TextView) {
            activeLabel.setPadding(0, 0, 0, 0);
        }
    }
}

in combination with @DhanalakshmiS answer, it works perfectly. There’s no padding at all and text remains the same:

<!-- Bottom Menu Override -->
<dimen name="design_bottom_navigation_text_size" tools:override="true">12sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">12sp</dimen>
Read more comments on GitHub >

github_iconTop Results From Across the Web

[BottomNavigationView] Long text cutting off in ... - Issue Tracker
In short, bolding of a label when a tab is selected is causing text to disappear. Issue summary.
Read more >
Android BottomNavigationView Truncating Text - Stack Overflow
Is there a way to disable BottomNavigationView's implementation of slighting enlarging the text/icon of a selected item? Thanks, Otterman.
Read more >
Control Text Size on Android Bottom Navigation View
Easily set a static text size for your tabs when using Bottom Navigation View.
Read more >
Some tips to a better experience working with Android's ...
BottomNavigationView creates bottom navigation bars, making it easy to explore and switch between top-level content views with a single tap.
Read more >
Bottom navigation - Material Design
The labelVisibilityMode attribute can be used to adjust the behavior of the text labels for each navigation item. There are four visibility modes:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found