1.
Import Customprogressdialog.java
2.
Styles.xml:
<style name= "Customprogressdialog" parent= "@android: Style/theme.dialog" >
<item name= "Android:windowbackground" > @android:color/transparent</item>
<item name= "Android:windownotitle" >true</item>
<item name= "Android:windowframe" > @null </item>
<item name= "Android:windowisfloating" >true</item>
<item name= "Android:windowcontentoverlay" > @null </item>
<item name= "Android:windowanimationstyle" > @android:style/animation.dialog</item>
<item name= "Android:windowsoftinputmode" >stateUnspecified|adjustPan</item>
</style>
3.
Define your own layout in \layout:
<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout
Xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
android:orientation= "Horizontal" >
<imageview
Android:id= "@+id/loadingimageview"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:background= "@anim/progress_round"/>
<textview
Android:id= "@+id/id_loadingmsg"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
Android:layout_gravity= "Center_vertical"
Android:textsize= "20DP"/>
</LinearLayout>
4.
To achieve the effect of rotation, the picture is displayed cyclically:
Anim in Progress_round.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<animation-list
Xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:oneshot= "false" >
<item android:drawable= "@drawable/progress_1" android:duration= "/>"
<item android:drawable= "@drawable/progress_2" android:duration= "/>"
<item android:drawable= "@drawable/progress_3" android:duration= "/>"
<item android:drawable= "@drawable/progress_4" android:duration= "/>"
<item android:drawable= "@drawable/progress_5" android:duration= "/>"
<item android:drawable= "@drawable/progress_6" android:duration= "/>"
<item android:drawable= "@drawable/progress_7" android:duration= "/>"
<item android:drawable= "@drawable/progress_8" android:duration= "/>"
</animation-list>
5.
Use
Import Com.youthforty.xxxxxx.CustomProgressDialog;
......
Private Customprogressdialog Pdialog=null;
......
if (Pdialog = = null) {
Pdialog = Customprogressdialog.createdialog (login.this);
Pdialog.setmessage ("Loading in ...");
}
Pdialog.show ();
......
Pdialog.dismiss ();
Android Custom ProgressDialog