加载纺车动画

sia*_*mii 22 animation android listview

我正在进行搜索并在结果列表中填充结果.在顶部有一个带有"正在搜索..."文本的栏.我想在右下角的栏中添加一个小的旋转轮动画,向用户显示正在进行的工作.

加载缩略图时,您可以在右上角的图库应用中看到此旋转轮.此外,当文件列在目录中时,Astro文件管理器中会显示相同的动画(再次右上角).

我怎么把它放在那里?

st0*_*0le 42

你需要调用requestWindowFeatureonCreate之前setContentView

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
        setContentView(R.layout.search_screen);
Run Code Online (Sandbox Code Playgroud)

并且假设您正在使用AsyncTask填充列表

onPreExecute() 将会通知 setProgressBarIndeterminateVisibility(true);

onPostExecute() 将会通知 setProgressBarIndeterminateVisibility(false);


RAA*_*AAM 13

我在我的申请中做了旋转进度条.希望这会对你有所帮助.

progDailog = ProgressDialog.show(this, "Progress_bar or give anything you want",
            "Give message like ....please wait....", true);
    new Thread() {
        public void run() {
            try {
                // sleep the thread, whatever time you want. 
                sleep(2000);
            } catch (Exception e) {
            }
            progDailog.dismiss();
        }
    }.start();
Run Code Online (Sandbox Code Playgroud)

如果你还有疑问,请告诉我.


Abh*_*bhi 6

        ProgressDialog dialog = new ProgressDialog(youravtivity.this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setMessage("Loading. Please wait...");
        dialog.setIndeterminate(true);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();
Run Code Online (Sandbox Code Playgroud)