[英]How to check which fragment is running at the moment. To make a condition out of this
我使用导航导航到其他片段。 我想添加一个条件,例如,如果(配置文件片段)正在运行,则 header 的 visibility = GONE。专家帮助解决问题enter image description here enter image description here
如何找出当前正在运行的片段
嘿,您可以查看以下链接以查找当前在特定时间可见的片段
NavHostFragment navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host);
navHostFragment.getChildFragmentManager().getFragments().get(0);
了解更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.