1

I created a BottomNavigationView. So far so well. Problem: When I select the last item, the title cuts of, because of its length, so I decided to remove the text when the user clicks on the items of the NavigationView.

This is what it looks like now

enter image description here

I want the Icon to be bigger and text to be removed when it is selected

But I do not know how?

activity_main.xml:

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottom_navigation"
    style="@style/Widget.Design.BottomNavigationView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:background="@color/transparent"
    android:backgroundTint="@color/colorPrimary"
    app:hideOnScroll="true"
    app:labelVisibilityMode="labeled"
    app:layout_scrollFlags="scroll|enterAlways"
    app:menu="@menu/bottom_app_bar_left" />

the menu.xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android">



<item
    android:id="@+id/nav_info"
    android:icon="@drawable/ic_baseline_info_24px"
    android:title="@string/nav_info" />

<item
    android:id="@+id/nav_vehicle"
    android:icon="@drawable/ic_baseline_tram_24px"
    android:title="@string/nav_vehicle"/>

<item
    android:id="@+id/nav_emptyspace"
    android:title=""
    android:enabled="false"/>



<item
    android:id="@+id/nav_computer"
    android:icon="@drawable/ic_baseline_computer_24px"
    android:title="@string/nav_computer"/>

<item
    android:id="@+id/nav_favorites"
    android:icon="@drawable/ic_grade_black_24dp"
    android:title="@string/nav_favorites"/>

Maharkus
  • 2,841
  • 21
  • 35
Karim Rak.
  • 13
  • 4
  • https://stackoverflow.com/a/50180808/7666442 – AskNilesh Mar 29 '19 at 10:27
  • Thank you for your idea! this solved the problem, there is not cut text anymore, when I use: app:labelVisibilityMode="selected" But I wanted the text to be seen by default and beeing removed when selected, not the other way around.. :/ – Karim Rak. Mar 29 '19 at 10:33

1 Answers1

1

Change the property to

app:labelVisibilityMode="unlabeled"

Icons will be there

Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77