activity_main.xml:
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:elevation="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0"
/>
bottom_bar.xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/tab_addcard"
android:enabled="true"
android:title="@string/addcard"
android:icon="@drawable/ic_tabicon_addcard"
app:showAsAction="ifRoom|withText"/>
<item
android:id="@+id/tab_approvals"
android:enabled="true"
android:title="@string/approvals"
android:icon="@drawable/ic_tabicon_approvals"
app:showAsAction="always|withText"/>
<item
android:id="@+id/tab_mycard"
android:enabled="true"
android:title="@string/mycard"
android:icon="@drawable/ic_tabicon_mycard"
app:showAsAction="always|withText"/>
MainActivity.java:
BottomNavigationView bottombar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bottombar= (BottomNavigationView) findViewById(R.id.bottom_navigation);
bottombar.inflateMenu(R.menu.bottom_bar);
}
My question is: After I finish everything from initialization of bottom bar to adding items in it. Once I run it and try rapidly (very fast) switching between item tabs of BottomNavigationView
suddenly in-between item title text disappears. Can anybody suggest me any solution?
It seems like one TextView
is disappear and another one is show on BottomNavigationView
item click. Looks laggy...
I had to set app:labelVisibilityMode="selected"
inside xml layout for my BottomNavigationView
. It show only selected item title for whole menu. And it looks good in my case. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With