您好,我想知道如何从 NavigationView 更改菜单 ID,在这种情况下,它是在用户单击 RadioButton 时触发的。我已经有了那部分,但我只需要知道如何更改菜单,因此在菜单中,单击 RadioButton 时它将显示不同的选项。
private var radioAdm:RadioButton? = null
private var radioAtle:RadioButton? = null
private var atletanav:BottomNavigationView? = null
private var menuopt = "@menu/admin_menu"
override fun onCheckedChanged(buttonView: CompoundButton?, isChecked: Boolean) {
// Here is where I need to put that code
}
Run Code Online (Sandbox Code Playgroud)
我已经试过了,但没有成功:
atleta_navbar.set(menu){menu=menuopt}
atleta_navbar.setTag(menuopt)
Run Code Online (Sandbox Code Playgroud)
所以在 NavigationView 它将从这个开始:
对此: