Search code examples
androidbottomnavigationview

How to avoid first item in BottomNavigationView set selected by default


I just want to avoid first item in BottomNavigationView set selected by default

 <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="bottom"
        android:background="?android:attr/windowBackground"
        android:foreground="?attr/selectableItemBackground"
        app:itemIconTint="@color/selector"
        app:itemTextColor="@color/selector"
        app:labelVisibilityMode="labeled"
        android:focusableInTouchMode="true"
        app:menu="@menu/bottam_navigation_manu"/>  

Solution

  • Try this

    Kotlin

     Bottomnavigation.menu.getItem(0).isCheckable = false
    

    java

    Bottomnavigation.getMenu().getItem(0).setChecked(false);
    

    this will help you