Android development, there are a lot of features in practical applications have played a large role, such as the implementation of the Android progress bar, below to introduce the Android Ring progress bar (the default form), the details are as follows:
. xml
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android"
xmlns:tools= "http:// Schemas.android.com/tools "
android:layout_width=" match_parent "
android:layout_height=" Match_parent "
android:orientation= "vertical"
tools:context= ". Mainactivity ">
<button
android:id=" @+id/mybut "
android:layout_width=" Wrap_content " android:layout_height= "Wrap_content"
android:text= "Find Network"/>
</LinearLayout>
. java
package com.example.progressdialog; import android.os.Bundle; import android.app.Activity;
Import Android.app.ProgressDialog;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.widget.Button; public class Mainactivity extends activity {private Button but=null; @Override protected void onCreate (Bundle Savedinstan Cestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); this.but= (Button)
Super.findviewbyid (r.id.mybut);
This.but.setOnClickListener (New Onclicklistenerimp ()); public class Onclicklistenerimp implements onclicklistener{public void OnClick (View v) {//Create our progress bar final Progressdialo
G Prodia=new ProgressDialog (mainactivity.this);
Prodia.settitle ("Search Network");
Prodia.setmessage ("Please wait patiently");
Prodia.onstart (); Anonymous inner class new Thread () {public void run () {try{thread.sleep (3000);} catch (Exception e) {} finally{//Anonymous inner class to access the data in the class, the data must be
Final Prodia.dismiss ()//Hidden dialog box}}}.start ();
Prodia.show (); }
}
}
The above content is small series to introduce the Android Ring progress bar (Android default form) of the relevant knowledge, I hope to help you!