Android ProgressBar Implementation Loading progress bar

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.