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布局文件

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns: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

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

重写ProgressDialog ,

  1. package com.zl.dialog.view;
  2. import com.zl.payslip.R;
  3. import android.app.Dialog;
  4. import android.app.ProgressDialog;
  5. import android.content.Context;
  6. import android.os.Bundle;
  7. /**
  8. * @author gqs
  9. * @version 创建时间:2012-11-23 上午10:59:43
  10. * 类说明
  11. */
  12. public class MyDialog  extends ProgressDialog{
  13. public PaySlipDialog(Context context, int theme) {
  14. super(context, theme);
  15. // TODO dvsdfads
  16. }
  17. public PaySlipDialog(Context context) {
  18. super(context);
  19. // TODO sdfsdf
  20. }
  21. @Override
  22. protected void onCreate(Bundle savedInstanceState) {
  23. // TODO Auto-generated method stub
  24. super.onCreate(savedInstanceState);
  25. //      progressDialog.setIndeterminate(true);
  26. setCancelable(false);
  27. //progressDialog.show()
  28. setContentView(R.layout.progressdialog_layout);
  29. }
  30. public void showDialog()
  31. {
  32. show();
  33. }
  34. }

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

public void showDialog(Context context)

{

MyDialog dialog = new MyDialog(context);

dialog.showDialog();

}

loading android的更多相关文章

  1. Android 一个绚丽的loading动效分析与实现!

    http://blog.csdn.net/tianjian4592/article/details/44538605 前两天我们这边的头儿给我说,有个 gif 动效很不错,可以考虑用来做项目里的loa ...

  2. android动画介绍--Animation 实现loading动画效果

    Animation的使用方法并不难.这里简单的介绍一下使用方法. 先看效果图: 效果还是不错的吧. 下面来看看使用方法. 动画效果是通过Animation来实现的,一共有四种,分别为: AlphaAn ...

  3. Android 网络加载通用Loading

    为了用户体验用好,App在网络请求时通常都会显示个进度显示圈圈,提示用户耐心等待,最脍炙人口的莫过于登录啦. 接下来我们就通过Dialog来实现,然后在BaseActivity,BaseFragmen ...

  4. android 瀑布流

    我们还是来看一款示例: 看起来很像我们的gridview吧,不过又不像,因为item大小不固定的,看起来是不是别有一番风味,确实如此.就如我们的方角图形,斯通见惯后也就出现了圆角.下面我简单介绍下实现 ...

  5. Android Tips – 填坑手册

    出于: androidChina   http://www.androidchina.net/3595.html 学习 Android 至今,大大小小的坑没少踩,庆幸的是,在强大的搜索引擎与无私奉献的 ...

  6. android 图片进度条

    png图片 代码 ImageView loading=getActivity().findViewById(R.id.pro_loading); LinearInterpolator lin = ne ...

  7. 一个绚丽的loading动效分析与实现!

    最终效果如下 从效果上看,我们需要考虑以下几个问题: 1.叶子的随机产生: 2.叶子随着一条正余弦曲线移动: 3.叶子在移动的时候旋转,旋转方向随机,正时针或逆时针: 4.叶子遇到进度条,似乎是融合进 ...

  8. android瀑布流效果(仿蘑菇街)

    Android 转载分享(10)  我们还是来看一款示例:(蘑菇街)           看起来很像我们的gridview吧,不过又不像,因为item大小不固定的,看起来是不是别有一番风味,确实如此. ...

  9. Android开源框架ImageLoader的完美例子

    本文转载于:http://blog.csdn.net/wwj_748/article/details/10079311 2013年8月19日开源框架之Universal_Image_Loader学习 ...

随机推荐

  1. STM32与LPC系列ARM资源之比较

    由于有周立公开发板的影响,LPC系列的开发板在工程师心目中一般是入门的最好型号之一.这次刚好有STM32的竞赛,正好将两者的资源进行比较一下(LPC系列以LPC213X为例). LPC213X包括LP ...

  2. Delphi通过调用COM对象实现更改桌面壁纸

    从前我也是用SystemParametersInfo这API来改桌面壁纸的,问题多多,也不知道哪错了,就没深究下去.看了CSDN的帖子后,大彻大悟~~         在XP下,SystemParam ...

  3. nexus 7 2013 驱动安装及root

    驱动安装 Nexus 7 2013连接上电脑后,设备管理器显示新设备 nexus 7 待安装驱动(其实是MTP设备待安装驱动).去谷歌网站下载最新的USB驱动,version 8.0 的.与以前的版本 ...

  4. Go语言Eclipse开发环境配置-Windows

    1.首先安装eclipse,选择一个适合的版本就好,解压即可 http://www.eclipse.org/downloads/ 2.下载go语言安装包 官网地址 :http://www.golang ...

  5. iterm快捷键及操作技巧(附Linux快捷键)

    标签操作 新建标签:command + t 关闭标签:command + w 切换标签:command + 数字 command + 左右方向键 切换全屏:command + enter 查找:com ...

  6. MySQL优化GROUP BY-松散索引扫描与紧凑索引扫描

    满足GROUP BY子句的最一般的方法是扫描整个表并创建一个新的临时表,表中每个组的所有行应为连续的,然后使用该临时表来找到组并应用累积函数(如果有).在某些情况中,MySQL能够做得更好,即通过索引 ...

  7. magento中取不同store中的产品数据

    $products = Mage::getResourceModel('catalog/product_collection')                    ->setStoreId( ...

  8. php 获取汉字拼音首字母的函数

    function getFirstChar($string){ if($string{0}>="A" and $string{0}<="z" )re ...

  9. UITableView进阶,cell刷新,界面返回 保持所选cell

    1.cell 刷新 NSIndexPath *indexPath_1=[NSIndexPath indexPathForRow:1 inSection:0]; NSArray *indexArray= ...

  10. The Tips of Success(成功的建议)

    1.Do one thing at a time,and do well. 2.Never forget to say "thanks". 3,Keep on going.Neve ...