1:  自定义的Dialog 代码:

public class IphoneProgersssDialog extends Dialog {
private Context context;
private ImageView img;
private TextView txt;
public IphoneProgersssDialog(Context context) {
super(context, R.style.iphone_progress_dialog);
this.context=context;
//加载布局文件
LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view=inflater.inflate(R.layout.iphone_progress_dialog, null);
img=(ImageView) view.findViewById(R.id.iphone_progress_dialog_img); // 进度图片
txt=(TextView) view.findViewById(R.id.iphone_progress_dialog_txt);
//给图片添加动态效果
Animation anim=AnimationUtils.loadAnimation(context, R.anim.progressbar);
img.setAnimation(anim); // 变成旋转
txt.setText(R.string.iphone_progressbar_dialog_txt);
//dialog添加视图
setContentView(view); } public void setMsg(String msg){ //进度提示消息
txt.setText(msg);
}
public void setMsg(int msgId){
txt.setText(msgId);
} }

2 ,dialog定义样式

<style name="iphone_progress_dialog" parent="@android:style/Theme.Dialog">    //构造方法中
<item name="android:windowFrame">@null</item> <!--Dialog的windowFrame框为无 -->
<item name="android:windowIsFloating">true</item><!-- 是否漂现在activity上 -->
<item name="android:windowIsTranslucent">true</item><!-- 是否半透明 -->
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item> //模糊
<item name="android:windowBackground">@drawable/load_bg</item> //dialog背景
</style>

3.定义动画文件  progressbar.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<rotate
android:interpolator="@android:anim/linear_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="+360"
android:duration="1000"
android:startOffset="-1"
android:repeatMode="restart"
android:repeatCount="-1"/>
</set>

Dialog 自定义使用2(进度条)的更多相关文章

  1. Android简易实战教程--第十七话《自定义彩色环形进度条》

    转载请注明出处:http://blog.csdn.net/qq_32059827/article/details/52203533   点击打开链接 在Android初级教程里面,介绍了shape用法 ...

  2. Android零基础入门第52节:自定义酷炫进度条

    原文:Android零基础入门第52节:自定义酷炫进度条 Android系统默认的ProgressBar往往都不能满足实际开发需要,一般都会开发者自定义ProgressBar. 在Android开发中 ...

  3. Android自定义圆角矩形进度条2

    效果图: 或 方法讲解: (1)invalidate()方法 invalidate()是用来刷新View的,必须是在UI线程中进行工作.比如在修改某个view的显示时, 调用invalidate()才 ...

  4. 低版本系统兼容的ActionBar(三)自定义Item视图+进度条的实现+下拉导航+透明ActionBar

           一.自定义MenuItem的视图 custom_view.xml (就是一个单选按钮) <?xml version="1.0" encoding="u ...

  5. WPF 自定义绕圈进度条

    在设计界面时,有时会遇到进度条,本次讲解如何设计自定义的绕圈进度条,直接上代码: 1.控件界面 <UserControl x:Class="ProgressBarControl&quo ...

  6. android 开发-自定义多节点进度条显示

    看效果图: 里面的线段颜色和节点图标都是可以自定义的. main.xml <RelativeLayout xmlns:android="http://schemas.android.c ...

  7. Android 自定义 View 圆形进度条总结

    Android 自定义圆形进度条总结 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 微信公众号:牙锅子 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 最近 ...

  8. Android:webView加载h5网页视频,播放不了,以及横屏全屏的问题和实现自定义加载进度条的效果

    1.webView加载h5网页视频,播放不了,android3.0之后要在menifest添加硬件加速的属性 android:hardwareAccelerated="true". ...

  9. Android 自定义圆形旋转进度条,仿微博头像加载效果

    微博 App 的用户头像有一个圆形旋转进度条的加载效果,看上去效果非常不错,如图所示: 据说 Instagram 也采用了这种效果.最近抽空研究了一下,最后实现的效果是这样: 基本上能模拟出个大概,代 ...

随机推荐

  1. Oracle数据库体系结构(2)数据库实例

    Oracle实例的概念: 实例(Instance):就是数据库管理系统,处于用户与物理数据库之间的一个中间层软件,由一系列内存结构和后台进程组成. 用户操作数据库的过程实质上与数据库实例建立连接,然后 ...

  2. [原创]java WEB学习笔记20:MVC案例完整实践(part 1)---MVC架构分析

    本博客为原创:综合 尚硅谷(http://www.atguigu.com)的系统教程(深表感谢)和 网络上的现有资源(博客,文档,图书等),资源的出处我会标明 本博客的目的:①总结自己的学习过程,相当 ...

  3. [算法]数组的partition调整

    题目一: 给定一个有序数组arr,调整arr使得这个数组的左半部分没有重复部分且升序,而不用保证右部分是否有序. 例如:arr=[1,2,2,2,3,3,4,5,6,6,7,7,8,8,9,9],调整 ...

  4. HDU 1800 Flying to the Mars 字典树,STL中的map ,哈希树

    http://acm.hdu.edu.cn/showproblem.php?pid=1800 字典树 #include<iostream> #include<string.h> ...

  5. 适用grunt的注意点

    0.使用grunt可以为前端开发省去很多工作量,与git版本控制器配合起来不要太完美,一般也都是这么用的: 1.先安装node.js,下载软件安装就行了,一般自带npm管理器; 2.通过npm安装gr ...

  6. Hessian 序列化和反序列化实现

    先聊聊 Java的序列化,Java官方的序列化和反序列化的实现被太多人吐槽,这得归于Java官方序列化实现的方式. 1.Java序列化的性能经常被吐槽.2.Java官方的序列化后的数据相对于一些优秀的 ...

  7. java读取pdf文档

    import java.io.*;import org.pdfbox.pdmodel.PDDocument;import org.pdfbox.pdfparser.PDFParser;import o ...

  8. php gizp压缩传输js和css文件

    1. [代码][PHP]代码    <?php     /**     *  完整调用示例:     *  1.combine.php?t=j&b=public&fs=jslib ...

  9. Python习题-一个函数实现读写功能

    def new_op_file(filename,content=None): f = open(filename,'a+') f.seek(0) if content: #非空即真,如果有内容就往下 ...

  10. Idea_学习_05_Intellij Idea自动添加注释的方法

    二.参考资料 1. Intellij Idea自动添加注释的方法