Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中显示进度控制或gif?_Android_Progress Bar_Android Activity - Fatal编程技术网

如何在android中显示进度控制或gif?

如何在android中显示进度控制或gif?,android,progress-bar,android-activity,Android,Progress Bar,Android Activity,当我点击按钮调用webservice时,它会等待加载新活动的记录,并在这段时间内将活动显示为空白 有谁能指导我如何在这段时间内显示进度吗?您可以显示活动的进度视图: public class MyActivity extends Activity { private static final int PROGRESS = 0x1; private ProgressBar mProgress; private Handler mHandler = new Hand

当我点击按钮调用webservice时,它会等待加载新活动的记录,并在这段时间内将活动显示为空白


有谁能指导我如何在这段时间内显示进度吗?

您可以显示活动的进度视图:

public class MyActivity extends Activity {
     private static final int PROGRESS = 0x1;

     private ProgressBar mProgress;

     private Handler mHandler = new Handler();

     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);

         setContentView(R.layout.progressbar_activity);

         mProgress = (ProgressBar) findViewById(R.id.progress_bar);
         mProgress.setIndeterminate(true);
         mProgress.setVisibility(true);

         // Start lengthy operation in a background thread
         new Thread(new Runnable() {
             public void run() {
                 doWork();
                 mProgress.setVisibility(false);
             }
         }).start();
     }
 }