Android progress bar ProgressBar

Source: Internet
Author: User

XML File Code section

<progressbar     android:id= "@+id/firstprobar"     android: Layout_width= "Match_parent"     android:layout_height= "Wrap_content"      android:max= "    android:progress=" "    style="? Android: Attr/progressbarstylehorizontal "    /><button     android: Id= "@+id/bt1"     android:layout_width= "Wrap_content"     android:layout _height= "Wrap_content"     android:layout_below= "@id/firstprobar"      Android:text= "Forward"     /><button     android:id= "@+id/bt2"     android:layout_width= "wrap_content"     android:layout_height= "wrap _content "    android:layout_below=" @id/bt1 "    android:text=" back      />

Mainactivity in code

private progressbar probar;private button bt1;private button bt2;      @Override     protected void oncreate (bundle savedinstancestate)  {        super.oncreate (savedinstancestate);         setcontentview (R.layout.activity_main);         probar= (ProgressBar) Findviewbyid (R.id.firstprobar);         probar.setmax (+);         /*probar.setprogress (;  )       boolean flag=probar.isindeterminate ();         toast.maketext (Getapplicationcontext (),  flag+ "",  toast.length_long). Show (); */         bt1= (Button) Findviewbyid (R.ID.BT1);         bt2= (ButtoN) Findviewbyid (R.ID.BT2);         firstlis f=new firstlis ();         secondlis s=new secondlis ();         bt1.setonclicklistener (f);         Bt2.setonclicklistener (s);     }    class firstlis implements  onclicklistener{@Overridepublic  void onclick (view v)  {probar.incrementprogressby (10) ;}             }    class  secondlis implements onclicklistener{@Overridepublic  void onclick (view v)  { Probar.incrementprogressby (-10);}             }


This article is from the "Java White Battlefield" blog, be sure to keep this source http://8023java.blog.51cto.com/10117207/1660207

Android progress bar ProgressBar

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.