创建“加载屏幕”适用于安卓
我解析 .html 页面并获取一组复选框,然后将复选框添加到布局和 setContentView(layout) 中。但解析速度很慢,我想在数据加载期间创建加载窗口。我不知道该怎么做,请帮助我。不管怎样,谢谢你。
I parse the .html page and take set of checkbox, than I add checkboxes to layout and setContentView(layout). But parsing is slow, and I want to create loading window during data is loading. I don't know how to do it, help me please. Thank you for, anyway.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为此,您可以实现 AsyncTask (无痛线程),在 onPreExecute() 方法中实现
ProgressBar
AsyncTask 的。正如我所标记的,它被称为无痛线程,因为我们开发人员不需要费心启动/暂停/停止线程,它是由 Android 本身管理的。
更新:
您还可以在 onPreExecute() 方法中显示 ProgressDialog,然后在 onPostExecute() 方法中隐藏它。同样,我建议您阅读这篇文章,非常有帮助:https://sites.google.com/site/androidhowto/how-to-1/asynctasks-with-progressdialogs
For that you can implement AsyncTask (Painless Threading), implement
ProgressBar
inside the onPreExecute() method of AsyncTask.As i have marked it is known as Painless Threading as we developer need not to bother about to start/pause/stop the thread, it is managed by Android itself.
Update:
You can also show ProgressDialog inside the onPreExecute() method and then hide the same in onPostExecute() method. For the same, i suggest you to go through this article, really helpful: https://sites.google.com/site/androidhowto/how-to-1/asynctasks-with-progressdialogs
您可以使用进度对话框来执行此操作。 Android 开发者网站上有一个教程,从这里开始解释:
链接在这里: http://developer.android.com/guide/topics/ ui/dialogs.html
You can do this using a progress dialog. There is a tutorial on the Android Developers Website, and this is where It starts to explain:
The Link is here: http://developer.android.com/guide/topics/ui/dialogs.html