本文介绍了底部导航视图:启动应用程序时更改默认突出显示的选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如上图所示,我具有此按钮导航视图,每次启动应用程序时,默认情况下都会突出显示类别"标签,但是我想在启动应用程序时突出显示首页"标签,有人帮我摆脱困境吗?
As shown above, I have this button navigation view, when ever I launch my application, in default my "Catagories" tab gets highlighted, but I want to get my "Home" tab get highlighted when i launch my application, can anyone help me get out of it?
推荐答案
尝试使用您的BottomNavigationView
的setSelectedItemId()
方法,如下所示
try this use setSelectedItemId()
method of your BottomNavigationView
like this
BottomNavigationView bottomNavigationView;
bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavigationView);
bottomNavigationView.setSelectedItemId(R.id.home_menu);
或像这样使用您的视图寻呼机的viewPager.setCurrentItem();
or use viewPager.setCurrentItem();
of your view pager like this
viewPager.setCurrentItem(2);
这篇关于底部导航视图:启动应用程序时更改默认突出显示的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!