答案 0 :(得分:4)
尝试使用setSelectedItemId()
这样的BottomNavigationView
方法
BottomNavigationView bottomNavigationView;
bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavigationView);
bottomNavigationView.setSelectedItemId(R.id.home_menu);
或使用您的视图寻呼机的viewPager.setCurrentItem();
viewPager.setCurrentItem(2);
答案 1 :(得分:0)
/***Just try to use below code snipet***/
viewPager.setCurrentItem(2);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
home_icon.setImageDrawable(getResources().getDrawable(R.drawable.home_icon_selected_state, getApplicationContext().getTheme()));
}
else
{
home_icon.setImageDrawable(getResources().getDrawable(R.drawable.home_icon_selected_state));
}