如何从DialogFragment调用FindViewById(android.r.id.content)?
我试图在对话片段中调用小吃吧。但是它显示在系统按钮之上。为了避免这种情况,我需要在小吃栏调用中调用findViewById(android.r.id.content)
。但不确定如何使其正确。
在父母片段中,我以这种方式打电话
Snackbar.make(requireActivity().findViewById(android.R.id.content), "fdfdfdf", Snackbar.LENGTH_LONG).show();
,它可以很好地工作,但问题在于对话fragment位于小吃栏的顶部,因此看不到。因此,我需要从对话框片段中调用它。但是,当我从对话框中调用它时,零食吧台看不到。
I am trying to call snack bar in dialog fragment. But it shows on top of system buttons. To avoid this I need to call findViewById(android.R.id.content)
in snack bar call. But not sure how to make it correct way.
In parent fragment I am calling this way
Snackbar.make(requireActivity().findViewById(android.R.id.content), "fdfdfdf", Snackbar.LENGTH_LONG).show();
and it works perfectly but the problem is that dialogfragment is on top of the snack bar so its not visible. So I need to call it from dialog fragment. But when I call it from dialog snack bar not visible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
[来源:https://stackoverflow.com/a/51150711/11831226]
[Source: https://stackoverflow.com/a/51150711/11831226]