Android的沙漏 [英] android hourglass
本文介绍了Android的沙漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以编程方式在Android应用程序显示一个沙漏?
How can I programmatically display an hourglass in an Android application ?
推荐答案
您可以使用<一个href="http://developer.android.com/intl/fr/reference/android/app/ProgressDialog.html"><$c$c>ProgressDialog$c$c>:
ProgressDialog dialog = new ProgressDialog(this);
dialog.setMessage("Thinking...");
dialog.setIndeterminate(true);
dialog.setCancelable(false);
dialog.show();
以上code将显示在您的活动
的顶部下面的对话框:
The above code will show the following dialog on top of your Activity
:
另外(或附加地),可以显示在你的活动的标题栏中的进度指示器
。
Alternatively (or additionally) you can display a Progress indicator in the title bar of your Activity
.
您need请以此为靠近你的活动的
使用下面code:的onCreate()
方法的顶部的功能
You need to request this as a feature near the top of the onCreate()
method of your Activity
using the following code:
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
然后打开它是这样的:
Then turn it on like this:
setProgressBarIndeterminateVisibility(true);
和关闭它是这样的:
setProgressBarIndeterminateVisibility(false);
这篇关于Android的沙漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文