drawal/loading.xml

<?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" />

、、-------------------------------------------------------------

总觉的自带的progressdialog很丑,所以为了让自己看着舒服一些,不得以就得自己定义样式了,自定义Progressdialog其实很简单,一个layout文件,一个shape文件

再来,然后再有一个资源文件就可以了。

一下是代码

自定义Progressdialog布局文件

[html] view plain copy
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:background="@drawable/bg_dialog_shape"
  6. android:gravity="center">
  7. <LinearLayout
  8. android:layout_width="wrap_content"
  9. android:layout_height="wrap_content"
  10. android:layout_gravity="center"
  11. android:gravity="center_horizontal"
  12. android:orientation="vertical">
  13. <ProgressBar
  14. android:id="@+id/oahprogressbar"
  15. style="@android:style/Widget.ProgressBar.Small"
  16. android:layout_width="30dip"
  17. android:layout_height="30dip"
  18. android:indeterminateDrawable="@drawable/progress"/>
  19. <TextView
  20. android:id="@+id/oaprogresstitle"
  21. android:layout_width="wrap_content"
  22. android:layout_height="wrap_content"
  23. android:layout_marginTop="20dip"
  24. android:gravity="center_vertical"
  25. android:text="正在验证..."
  26. android:textColor="@color/white"/>
  27. </LinearLayout>
  28. </FrameLayout>

ProgressBar

[html] view plain copy
  1. indeterminateDrawable的属性
[html] view plain copy
  1. <?xmlversion="1.0"encoding="utf-8"?>
  2. <rotatexmlns:android="http://schemas.android.com/apk/res/android">
  3. <rotatexmlns:android="http://schemas.android.com/apk/res/android"
  4. android:drawable="@drawable/loading"<!--这就是一张图片,不需要每一个状态一张图片-->
  5. android:pivotX="50%"
  6. android:pivotY="50%"/>
  7. </rotate>



重写ProgressDialog ,

[java] view plain copy
  1. packagecom.zl.dialog.view;
  2. importcom.zl.payslip.R;
  3. importandroid.app.Dialog;
  4. importandroid.app.ProgressDialog;
  5. importandroid.content.Context;
  6. importandroid.os.Bundle;
  7. /**
  8. *@authorgqs
  9. *@version创建时间:2012-11-23上午10:59:43
  10. *类说明
  11. */
  12. publicclassMyDialogextendsProgressDialog{
  13. publicPaySlipDialog(Contextcontext,inttheme){
  14. super(context,theme);
  15. //TODOdvsdfads
  16. }
  17. publicPaySlipDialog(Contextcontext){
  18. super(context);
  19. //TODOsdfsdf
  20. }
  21. @Override
  22. protectedvoidonCreate(BundlesavedInstanceState){
  23. //TODOAuto-generatedmethodstub
  24. super.onCreate(savedInstanceState);
  25. //progressDialog.setIndeterminate(true);
  26. setCancelable(false);
  27. //progressDialog.show()
  28. setContentView(R.layout.progressdialog_layout);
  29. }
  30. publicvoidshowDialog()
  31. {
  32. show();
  33. }
  34. }


loading android

最后在Acivity里面直接调用就行了

public void showDialog(Context context)

{

MyDialog dialog = new MyDialog(context);

dialog.showDialog();

}

更多相关文章

  1. Android实现图片缩放与旋转
  2. Android Studio点击按钮更换背景图片
  3. AndroidMenifest.xml(Android清单文件)内部代码分析
  4. android图片放大 缩小 旋转
  5. Android布局文件中的属性含义
  6. Android 怎么给图片添加一个边框
  7. Android开发进阶:如何读写Android文件
  8. android studio 使用adb命令传递文件到android设备
  9. 第三课:android数据相关---文件

随机推荐

  1. Android(安卓)scrollview里面放listview
  2. 【Android(安卓)开发教程】AnalogClock和
  3. Android数据过滤器:Filter
  4. Android使用WebView加载网页选择文件上传
  5. Android(java)学习笔记104:Map集合的遍历之
  6. Android(安卓)Audio 创建AudioTrack对象
  7. achartengine之折线图---简单用法
  8. Android实现单页显示3个Item的ViewPager
  9. actionbar 详解教程
  10. android发送