我一直在尝试使菜单项看起来可点击,但我不确定。但是我确信它不会按照我的计划进行
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id;
id = item.getItemId();
if(id == R.id.fndclss){
Intent fndclss;
fndclss = new Intent(MainActivity.this,ongoingtask.class);
MainActivity.this.startActivity(fndclss);
}
DrawerLayout menu;
menu = (DrawerLayout) findViewById(R.id.drawer);
menu.closeDrawer(GravityCompat.START);
return false;
}
答案 0 :(得分:0)
您应尝试使用->
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id;
id = item.getItemId();
if(id == R.id.fndclss){
Intent fndclss = new Intent(MainActivity.this, ongoingtask.class);
startActivity(fndclss);
return true;
}
DrawerLayout menu;
menu = (DrawerLayout) findViewById(R.id.drawer);
menu.closeDrawer(GravityCompat.START);
return true;
}