如何显示“等待” Android 上活动标题中的图标?
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS)
对我来说不起作用,因为它应该在活动中的 onCreate
之前调用,而我只需要在用户按下此活动中的按钮时才显示它。
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS)
doesn't work for me, since it should be called before onCreate
in the Activity, when I need to show it only when user pressed button in this Activity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你走在正确的轨道上。您确实想要使用:
技巧是通过以下方式切换微调器的显示:
传递
true
以显示,false
以隐藏。因此,在您的 Activity init 或 UI init 中,然后使用 false 调用它以隐藏它,然后使用 true 再次调用它以在单击按钮时显示它。You're on the right track. You do want to use:
The trick is to toggle the display of the spinner via:
Pass
true
to show,false
to hide. So in your Activity init or UI init then call it with false to hide it, then call it again with true to show it when your button click is fired.我相信您仍然可以通过 PROGRESS_VISIBILITY_OFF 设置进度条的可见性调用
setContentView
后,PROGRESS_VISIBILITY_ON。事实上,您可以在
onCreate
中设置FEATURE_INDETERMINATE_PROGRESS,只需在调用setContentView
之前即可。I believe you can still set the progress bar's visibility via PROGRESS_VISIBILITY_OFF and PROGRESS_VISIBILITY_ON after you've called
setContentView
.You can in fact set FEATURE_INDETERMINATE_PROGRESS in
onCreate
, it just needs to be beforesetContentView
is called.