Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.3k views
in Technique[技术] by (71.8m points)

xml - How to add text in BottomAppBar in android

I want to create Bottom navigation view in my app which has text something like this in screenshot below

dadadadad

Here in this screenshot GN is showing how can I add this in my bottom nav bar.I have added it in menu but its not showing properly like screenshot.

Below is my code:

 <com.google.android.material.bottomnavigation.BottomNavigationView
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:background="#fff"
    android:layout_alignParentBottom="true"
    android:id="@+id/navView"
    app:itemIconTint="@drawable/nav_check"
    app:itemTextColor="@drawable/nav_check"
    app:menu="@menu/bottom_menu" />

bottom_menu.xml

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

<item
    android:id="@+id/randomFragment"
    android:title="GN"
    tools:ignore="HardcodedText" />

<item
    android:id="@+id/homeFragment2"
    android:icon="@drawable/ic_search"
    android:title=""
    tools:ignore="HardcodedText" />

<item
    android:id="@+id/cartFragment"
    android:icon="@drawable/ic_cart"
    android:title=""
    tools:ignore="HardcodedText" />

<item
    android:id="@+id/accountFragment2"
    android:icon="@drawable/ic_person"
    tools:ignore="HardcodedText"
    android:title="" />

</menu>

Someone please let me know how can I achieve desired layout. Any help would be appreciated.

THANKS


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...