0
0
0ralo2020-07-20 14:28:50
Android
0ralo, 2020-07-20 14:28:50

Why is the text of BottomNavigationView items not showing?

I have an app with a BottomNavigationView that has a nested menu. As far as I know (I saw it on Google), you can put from 3 to 5 elements in the BottomNavigationView, but after adding 4 (or more) elements, the text remains only on the first button.

4 buttons

5f157c90a83c6367328909.png

menu.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:title="1"
        android:id="@+id/item1"
        android:color="@android:color/black"/>
    <item
        android:title="2"
        android:id="@+id/item2"
        android:color="@android:color/black"
        />
    <item
        android:title="3"
        android:id="@+id/item3"
        android:color="@android:color/black"
        />
    <item
        android:title="4"
        android:id="@+id/item4"
        android:color="@android:color/black"/>
</menu>


The buttons do not have a title, but the buttons themselves work. On the device, when you press the button in place, there is an animation and an action that I signed.
If you remove one item from the menu, then everything will be displayed correctly.
3 buttons

5f157df14aee9132696617.png

menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:title="1"
        android:id="@+id/item1"
        android:color="@android:color/black"/>
    <item
        android:title="2"
        android:id="@+id/item2"
        android:color="@android:color/black"
        />
    <item
        android:title="3"
        android:id="@+id/item3"
        android:color="@android:color/black"
        />
</menu>

However, if you make 4 elements, and put a picture in the item menu, the picture will be displayed
4 buttons + pictures
5f157ee41472d901810792.png

What should I do to display all titles correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekseyHunter, 2020-07-25
@alekseyHunter

As far as I know (I saw it on Google), BottomNavigationView can contain from 3 to 5 elements

There is no such limitation. From 3 to 5, Material Design interprets, otherwise the rest will become unreadable and the interface will become more complicated.
The text is shown only when you click on an element (for the active tab), if there are many elements.
5f1bd412541c2248068109.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question