ProgressBar Android progress bar component. Key properties of ProgressBar: android:max= "100" max Display progress bar android:progress= "500" first display progress android:secondaryprogress= "8 0 "Second display progress android:indeterminate=" true "sets whether the ProgressBar key method is displayed accurately: setprogress (int) sets the first progress. setsecondaryprogress (int) Set second progress getprogress () Get first progress getsecondaryprogress () get second progress Incrementprog Ressby (int) Increases or decreases the first progress Incrementsecondaryprogressby (int) to increase or decrease the second progress Getmax () to get the maximum progress. ProgressBar display style: Do not set style to middle ring progress barstyle="Android:attr/progressbarstylelarge"//Big ringShapeprogress bar style= "? Android:attr/progressbarstylesmall"//Small Loop progress bar style= "? Android:attr/progressbarstylehorizontal"//Horizontal progress bar ProgressBar Classificationaccurate display of progress and non-accurate display of progress. ProgressBar on the title bar@Override protected void onCreate (Bundle savedinstancestate) { Super. OnCreate (savedinstancestate);Setcontentview (r.layout. Activity_main); //Startup Window featuresrequestwindowfeature (Window. feature_progress);requestwindowfeature (Window. feature_indeterminate_progress); //Displays two progress bars. setprogressbarvisibility ( true);setprogressbarindeterminatevisibility ( true);setprogress (600); //Set the Tick Max progress value for the progress bar with progress to constant 10000 }A progress bar in the form of a dialog box@Override protected void onCreate (Bundle savedinstancestate) { Super. OnCreate (savedinstancestate);Setcontentview (r.layout. Activity_main); //New ProgressDialog object ProgressDialog=New ProgressDialog (mainactivity. This); //Set display style ProgressDialog. Setprogressstyle (ProgressDialog .Style_horizontal); //Set title ProgressDialog. Settitle ("" ); /** Set some properties on the Champions League warm bar */ //Set Maximum progress ProgressDialog. Setmax (+); //Set initialization has increased progress ProgressDialog. Incrementprogressby (); //Specifies that the progress bar is a clear indication of progress ProgressDialog. Setindeterminate (false); //Set a button ProgressDialog. Setbutton (dialoginterface.button_positive,"OK", New Dialoginterface.onclicklistener () { @Override Public void OnClick (Dialoginterface dialog, int which) {Toast. Maketext (Mainactivity. This, "", Toast.Length_long). Show (); } }); //Whether you can exit the dialog box by returning the button ProgressDialog. Setcancelable (true); //Display Progredialog ProgressDialog. Show (); }
Android ProgressBar Implementation Loading progress bar