Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.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水平确定进度条未运行_Android_Material Design - Fatal编程技术网

Android水平确定进度条未运行

Android水平确定进度条未运行,android,material-design,Android,Material Design,我正在尝试将不确定进度条更改为确定水平进度条,但确定进度条在不确定的情况下不起作用 确定的一个出现,但没有运动。 请帮帮我 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.and

我正在尝试将不确定进度条更改为确定水平进度条,但确定进度条在不确定的情况下不起作用

确定的一个出现,但没有运动。 请帮帮我

 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/check"
android:layout_width="match_parent"
android:layout_height="match_parent">
   <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content" >
     <ProgressBar  
     android:id="@+id/my_progressBar"
     style="@style/Widget.AppCompat.ProgressBar.Horizontal"
    android:indeterminate="false"
    android:max="100"
    android:progress="10"/>
    </LinearLayout>
    </android.support.design.widget.CoordinatorLayout>

我认为进度条不会增加,因为你不会增加进度。如果将setProgress设置为20,则该条将保持在20

如果想看到运动,必须逐步增加设置进度

我希望它能有所帮助。

private int progressStatus=10;
 private int progressStatus = 10;        
 new Thread(new Runnable() {
           public void run() {

                   while (progressStatus < 100) {

                           progressStatus += 5;

                           // Update the progress bar and display the
                           //current value in the text view
                           handler.post(new Runnable() {
                               public void run() {
                                   progressBar.setProgress(progressStatus);
                        textView.setText(progressStatus+"/"+progressBar.getMax());

                               }
                           });
                           try {
                               // Sleep for 300 milliseconds.
                               //Just to display the progress slowly
                               Thread.sleep(300);
                           } catch (InterruptedException e) {
                               e.printStackTrace();
                           }


               }

           }
       }).start();
新线程(newrunnable()){ 公开募捐{ 而(进度状态<100){ 进展状态+=5; //更新进度条并显示 //文本视图中的当前值 handler.post(新的Runnable(){ 公开募捐{ progressBar.setProgress(progressStatus); textView.setText(progressStatus+“/”+progressBar.getMax()); } }); 试一试{ //睡眠300毫秒。 //只是为了慢慢地显示进度 睡眠(300); }捕捉(中断异常e){ e、 printStackTrace(); } } } }).start();
进度从20开始,不增加?@Diekrul是的,它保持在那里,不增加
 private int progressStatus = 10;        
 new Thread(new Runnable() {
           public void run() {

                   while (progressStatus < 100) {

                           progressStatus += 5;

                           // Update the progress bar and display the
                           //current value in the text view
                           handler.post(new Runnable() {
                               public void run() {
                                   progressBar.setProgress(progressStatus);
                        textView.setText(progressStatus+"/"+progressBar.getMax());

                               }
                           });
                           try {
                               // Sleep for 300 milliseconds.
                               //Just to display the progress slowly
                               Thread.sleep(300);
                           } catch (InterruptedException e) {
                               e.printStackTrace();
                           }


               }

           }
       }).start();