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. rails 运维常用命令

    创建生产环境数据库并执行迁移 $ RAILS_ENV=production rake db:create$ RAILS_ENV=production rake db:migrate RAILS_ENV ...

  2. rails数据验证

    @user1 = :name => "zhou" 与 @user2 = :name=> "ZHOU" 在为保存之前都有可能通过第一关validate ...

  3. c++ 之重要性

    c++的功能比c语言大的多,c语言偏最底层,且程序短小,而对于一个大的系统,用c++,因为它具备了c语言的优点. 很多学嵌入式的觉得学了c语言之后,就不用学c++了,会认为c++很简单,然而,c++并 ...

  4. 每天一个Linux命令(17)whereis命令

    whereis命令只能用于程序名的搜索,而且只搜索二进制文件(参数-b).man说明文件(参数-m)和源代码文件(参数-s).如果省略参数,则返回所有信息.     (1)用法:   用法:    w ...

  5. curl 监控web

    [root@rhel6 ~]# curl -I -s -w "%{http_code}\n" -o /dev/null http://127.0.0.1 [root@rhel6 ~ ...

  6. SpringBoot2.0之整合RabbitMQ

    案例: Springboot 对RabbitMQ的支持 公共的pom: <project xmlns="http://maven.apache.org/POM/4.0.0" ...

  7. 算法(Algorithms)第4版 练习 1.5.8

    假设原id数组: 0 1 1 4 4 8 6 1 8 0 输入p = 5, q = 7 则输出结果会出错,最终为: 0 1 1 4 4 1 6 1 8 0 因为当id[p](id[5] = 8)被赋值 ...

  8. Android 基础-3.0 数据存储方式

    Android几种数据存储方式 文件存储 SharedPreference存储 Json解析 SQLite数据库存储 文件存储 文件存储是Android中最基本的一种存储方式,和Java中实现I/O的 ...

  9. PHP使用http_build_query()构造URL字符串的方法

    http_build_query http_build_query -- 生成 url-encoded 之后的请求字符串描述string http_build_query ( array formda ...

  10. BEC listen and translation exercise 47

    Site One was unpopular because of traffic and parking problems.场地一由于交通和停车问题而不受欢迎. The bombs killed a ...