android - 底部导航 View : Change the default highlighted Tab when the app launches

标签 android android-layout bottomnavigationview

My Navigation View

如上所示,我有这个按钮导航 View ,每当我启动我的应用程序时,默认情况下我的“类别”选项卡会突出显示,但我想让我的“主页”选项卡在我启动我的应用程序时突出显示,可以有人帮我摆脱它吗?

最佳答案

像这样尝试使用 BottomNavigationViewsetSelectedItemId() 方法

BottomNavigationView bottomNavigationView;
bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavigationView);
bottomNavigationView.setSelectedItemId(R.id.home_menu);

或者像这样使用 View 寻呼机的 viewPager.setCurrentItem();

viewPager.setCurrentItem(2);

关于android - 底部导航 View : Change the default highlighted Tab when the app launches,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46048657/

相关文章:

安卓导航 View : Scroll the menu items only issue

android - 使用 TextView 自动调整线性布局的大小

android - Android 适配器 getView() 中 2 个布局的动态膨胀

android - BottomNavigationView没有显示

android - 在滚动上隐藏/显示底部导航 View

java - 如何检索 JSONObject 子字段?

android - 如何防止 JobService 使用的 AsyncTask 中的上下文泄漏

java - 底部导航图标仅在单击两次后才会更改颜色?

android - 如何通过用户电子邮件获取 userID Firebase android?

android - 在不安装新 APK 的情况下更新应用程序