drawal/loading.xmlhtml
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate android:drawable="@drawable/share_popout_icon_loading" android:pivotX="50.0%" android:pivotY="50.0%"
xmlns:android="http://schemas.android.com/apk/res/android" />java
、、-------------------------------------------------------------android
總覺的自帶的progressdialog很醜,因此爲了讓本身看着舒服一些,不得以就得本身定義樣式了,自定義Progressdialog其實很簡單,一個layout文件,一個shape文件web
再來,而後再有一個資源文件就能夠了。app
一下是代碼ide
自定義Progressdialog佈局文件oop
- <?xml version="1.0" encoding="utf-8"?>
- <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/bg_dialog_shape"
- android:gravity="center" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center_horizontal"
- android:orientation="vertical" >
-
- <ProgressBar
- android:id="@+id/oahprogressbar"
- style="@android:style/Widget.ProgressBar.Small"
- android:layout_width="30dip"
- android:layout_height="30dip"
- android:indeterminateDrawable="@drawable/progress" />
-
- <TextView
- android:id="@+id/oaprogresstitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dip"
- android:gravity="center_vertical"
- android:text="正在驗證..."
- android:textColor="@color/white" />
- </LinearLayout>
-
- </FrameLayout>
ProgressBar 佈局
- <?xml version="1.0" encoding="utf-8"?>
- <rotate xmlns:android="http://schemas.android.com/apk/res/android" >
- <rotate xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/loading"
- android:pivotX="50%"
- android:pivotY="50%" />
-
- </rotate>
重寫ProgressDialog ,this
- package com.zl.dialog.view;
-
- import com.zl.payslip.R;
-
- import android.app.Dialog;
- import android.app.ProgressDialog;
- import android.content.Context;
- import android.os.Bundle;
-
-
-
-
-
-
- public class MyDialog extends ProgressDialog{
-
- public PaySlipDialog(Context context, int theme) {
- super(context, theme);
-
- }
-
- public PaySlipDialog(Context context) {
- super(context);
-
-
- }
- @Override
- protected void onCreate(Bundle savedInstanceState) {
-
- super.onCreate(savedInstanceState);
-
-
- setCancelable(false);
-
-
- setContentView(R.layout.progressdialog_layout);
-
- }
- public void showDialog()
- {
- show();
- }
- }
最後在Acivity裏面直接調用就好了url
public void showDialog(Context context)
{
MyDialog dialog = new MyDialog(context);
dialog.showDialog();
}