Jay Jay - 1 month ago 8
Java Question

Goggle BottomNavigationView item title disappears after few rapid tab switch

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"?>




<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(v.fast) switching between item tabs of BottomNavigationView suddenly in between item title text disappears.
Can anybody suggest me any solution??
Thanks in advance!!

Answer Source

setOnNavigationItemSelectedListener should return false instead of true