使用导航控制器实现底部导航时应用崩溃

App Crashes when Implementing Bottom navigation with nav controller

提问人:Amazing MrBilll 提问时间:11/1/2023 更新时间:11/1/2023 访问量:15

问:

NavController navController = Navigation.findNavController(this, R.id.fragment);

BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView);
NavigationUI.setupWithNavController(bottomNavigationView, navController);

每当我运行此代码时,应用程序都会崩溃,并且我已经完美地链接了所有 ID 我该怎么办?

我只是想要一个功能正常的底部导航栏,应用程序崩溃了

java android 导航 bottomnavigationview android-navhostfragment

评论

2赞 Aswin P Ashok 11/1/2023
附加堆栈跟踪
0赞 sandeep-prabhakula 11/1/2023
附加错误堆栈跟踪,还提供具有 NavHost 小部件的 XML 文件

答: 暂无答案