[英]Bottom Navigation showing in other fragment
使用addOnDestinationChangedListener
并隐藏和显示关于destinationId的bottomNavigation
private val AUTH_NAV_GRAPH = arrayOf(
R.id.destination_splash,
R.id.destination_login,
R.id.destination_register,
R.id.destination_forgetpassword
)
val navController = findNavController(this,R.id.nav_host_fragment)// this maybe change
navController.addOnDestinationChangedListener { controller, destination, arguments ->
if(destination.id in AUTH_NAV_GRAPH) {
bottomNavigation?.visibility=View.GONE
} else {
bottomNavigation?.visibility=View.VISIBLE
}
}
其中AUTH_NAV_GRAPH
就像没有bottomNavigation
的片段
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.