我使用片段作为底部导航。
我已经定义了一个主题,父主题为Theme.MaterialParents.NothingBar.Bridge。
它在 * 活动 * 上工作得很好,但是片段显示了一个缺口。
这是BottomNavigationActivity
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
firebaseAnalytics = FirebaseAnalytics.getInstance(this)
val user = userFromIntent
initGoogleSignInClient()
binding = ActivityBottomNavigationMenuBinding.inflate(layoutInflater)
setContentView(binding.root)
val navView: BottomNavigationView = binding.navView
val navController = findNavController(R.id.nav_host_fragment_activity_main)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(
R.id.navigation_home, R.id.navigation_activities, R.id.navigation_more
)
)
navView.setupWithNavController(navController)
}
字符串
这是MoreFragment的一部分。
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
): View {
fragmentMoreBinding = FragmentMoreBinding.inflate(inflater, container, false)
型
有什么想法吗?我尝试过类似的东西:
第一个月
1条答案
按热度按时间bvjveswy1#
删除了XML上的android:paddingTop="?attr/actionBarSize我有nav_host_fragment_activity_main,它工作了!