技术点:
dialog;ProgressBar;animated-rotate;
弹出框:
import com.carspeak.client.R; import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.Gravity;
import android.widget.ImageView;
import android.widget.TextView; /**
* 等待进度条
* @author huqiang
*
*/
public class WaitProgressDialog extends Dialog {
private Context context = null;
private static WaitProgressDialog wProgressDialog = null; public WaitProgressDialog(Context context){
super(context);
this.context = context;
} public WaitProgressDialog(Context context, int theme) {
super(context, theme);
} public static WaitProgressDialog createDialog(Context context){
wProgressDialog = new WaitProgressDialog(context,R.style.WaitProgressDialog);
wProgressDialog.setContentView(R.layout.waitprogressdialog);
wProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER; return wProgressDialog;
}
}
R.style.WaitProgressDialog:
<style name="WaitProgressDialog" parent="@style/TipsDialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
R.layout.waitprogressdialog:
<?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">
<ProgressBar
android:id="@+id/pb_process"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
style="?android:attr/progressBarStyle"
android:indeterminate="false"
android:indeterminateDrawable="@anim/process_round"/>
</LinearLayout>
@anim/process_round:
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_loading"
android:pivotX="50%"
android:pivotY="50%" />