@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
menuItem.setChecked(true);
Fragment fragment = new PostsFragment();
String title = getString(R.string.posts);
switch (menuItem.getItemId()) {
case R.id.action_home:
setFABVisibility(true);
break;
case R.id.action_peoples:
title = getString(R.string.users);
setFABVisibility(false);
fragment = new UsersFragment();
break;
case R.id.action_notifications:
title = getString(R.string.notifications);
setFABVisibility(false);
fragment = new NotificationsFragment();
break;
case R.id.action_messages:
title = getString(R.string.messages);
setFABVisibility(false);
fragment = new NotificationsFragment();
break;
}
// change toolbar title
setTitle(title);
// Replace with the selected fragment
IntentUtils.replaceFragment(R.id.frame_layout,
getSupportFragmentManager(), fragment);
return false;
}
MainActivity.java 文件源码
java
阅读 44
收藏 0
点赞 0
评论 0
项目:Programmers
作者:
评论列表
文章目录