Set selected item in Android BottomNavigationView

前端 未结 21 2327
谎友^
谎友^ 2020-11-27 14:16

I am using the new android.support.design.widget.BottomNavigationView from the support library. How can I set the current selection from code? I realized, that

21条回答
  •  感情败类
    2020-11-27 15:08

    Add android:enabled="true" to BottomNavigationMenu Items.

    And then set bottomNavigationView.setOnNavigationItemSelectedListener(mListener) and set it as selected by doing bottomNavigationView.selectedItemId = R.id.your_menu_id

提交回复
热议问题