我正在处理这段代码
private void setupViews(){
frameLayout = (FrameLayout) findViewById(R.id.frame_id);
bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_nav_id);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_id,new ProfileFragment()).commit();
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
int navID = menuItem.getItemId();
switch (navID){
case R.id.home:
getSupportFragmentManager().beginTransaction().replace(R.id.frame_id,new HomeFragment()).commit();
break;
case R.id.search:
getSupportFragmentManager().beginTransaction().replace(R.id.frame_id,new SearchFragment()).commit();
break;
case R.id.profile:
getSupportFragmentManager().beginTransaction().replace(R.id.frame_id,new ProfileFragment()).commit();
break;
}
return true;
}
当我启动我的应用程序时,它会自动进入第一个底部(我有 3 个底部)我想在导航视图中将其更改为第二个底部。请帮我