我不能在同一活动中使用BottomNavigationView
和NavigationView
。当我使用NavigationView
时,BottomNavigationView
点击监听器不起作用,但是BottomNavigationView
点击监听器起作用。 BottomNavigationView
以某种方式阻止了NavigationView
的点击监听器。寻求帮助
bottomnavid.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
if(menuItem.getItemId()==R.id.homeid)
{
Toast.makeText(getApplicationContext(),"home",Toast.LENGTH_LONG).show();
}
return false;
}
});
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
if(menuItem.getItemId()==R.id.ilkYanMenuItemid)
{
Toast.makeText(getApplicationContext(),"ilk yan",Toast.LENGTH_LONG).show();
}
return false;
}
});