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. 机器学习Coursera学习总结

    Coursera上Andrew NG的机器学习实在是太火了,最近有时间花费了20来天的时间(每天3小时左右)终于学习完了全部的课程,总结如下: (1)适合入门,讲的比较基础,Andrew讲的很棒: ( ...

  2. 视图的创建与使用 Sql Server View

    创建教材的三个数据表Student.Course及SC. create database S_T Use S_T CREATE TABLE Student (Sno CHAR(9), Sname CH ...

  3. shiro4----shiro3代码

    AuthenticationTest.java package cn.itcast.shiro.authentication; import org.apache.shiro.SecurityUtil ...

  4. [转]Mysql命令

    1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root ...

  5. 【leetcode刷题笔记】3Sum

    Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...

  6. nginx别名配置,状态配置,include优化

    一.nginx帮助参数 下面是关于/application/nginx/sbin/nginx 的参数帮助 [root@A conf]# /application/nginx/sbin/nginx -h ...

  7. UVA 101 vector

    题目链接 白书上的例题,关于vector的使用.不定长数组vector,类型内部封装了一些常用操作.vector就像一个二维数组,只有第一维的大小是固定的,可以像数组一样访问到其中的每一个元素. ve ...

  8. 阻挡ddos攻击的函数

  9. 大话设计模式--代理模式 proxy

    1. 代理模式: 为其他对象提供一种代理以控制这个对象的访问. 代理模式使用场合: a. 远程代理, 为一个对象在不同的地址空间提供局部代理,隐藏一个对象存在于不同地址空间的事实.如.net中WebS ...

  10. The Quantum L3 router and floating IPs

    This post shows how the Quantum L3 Agent uses the Linux IP stack to implement the Quantum L3 Routing ...