Dialog 自定义使用2(进度条)
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(进度条)的更多相关文章
- Android简易实战教程--第十七话《自定义彩色环形进度条》
转载请注明出处:http://blog.csdn.net/qq_32059827/article/details/52203533 点击打开链接 在Android初级教程里面,介绍了shape用法 ...
- Android零基础入门第52节:自定义酷炫进度条
原文:Android零基础入门第52节:自定义酷炫进度条 Android系统默认的ProgressBar往往都不能满足实际开发需要,一般都会开发者自定义ProgressBar. 在Android开发中 ...
- Android自定义圆角矩形进度条2
效果图: 或 方法讲解: (1)invalidate()方法 invalidate()是用来刷新View的,必须是在UI线程中进行工作.比如在修改某个view的显示时, 调用invalidate()才 ...
- 低版本系统兼容的ActionBar(三)自定义Item视图+进度条的实现+下拉导航+透明ActionBar
一.自定义MenuItem的视图 custom_view.xml (就是一个单选按钮) <?xml version="1.0" encoding="u ...
- WPF 自定义绕圈进度条
在设计界面时,有时会遇到进度条,本次讲解如何设计自定义的绕圈进度条,直接上代码: 1.控件界面 <UserControl x:Class="ProgressBarControl&quo ...
- android 开发-自定义多节点进度条显示
看效果图: 里面的线段颜色和节点图标都是可以自定义的. main.xml <RelativeLayout xmlns:android="http://schemas.android.c ...
- Android 自定义 View 圆形进度条总结
Android 自定义圆形进度条总结 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 微信公众号:牙锅子 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 最近 ...
- Android:webView加载h5网页视频,播放不了,以及横屏全屏的问题和实现自定义加载进度条的效果
1.webView加载h5网页视频,播放不了,android3.0之后要在menifest添加硬件加速的属性 android:hardwareAccelerated="true". ...
- Android 自定义圆形旋转进度条,仿微博头像加载效果
微博 App 的用户头像有一个圆形旋转进度条的加载效果,看上去效果非常不错,如图所示: 据说 Instagram 也采用了这种效果.最近抽空研究了一下,最后实现的效果是这样: 基本上能模拟出个大概,代 ...
随机推荐
- ubuntu 安装 phpstorm
phpstorm是用JAVA开发的,所以在安装之前需要先安装jdksudo apt-get install default-jdk从官网上下载phpstorm 的linux版本 http://www. ...
- Java EE规范是如何制定的
我们经常做的JAVA EE开发实际上都是遵从了JAVA EE的规范进行的,那么这些规范是如何制定的呢? 这就不得不提到JCP这个组织了. JCP( Java Community Process)可以翻 ...
- Data Structure Binary Tree: Construct Full Binary Tree from given preorder and postorder traversals
http://www.geeksforgeeks.org/full-and-complete-binary-tree-from-given-preorder-and-postorder-travers ...
- SPFA 算法(剪辑)(学习!)
SPFA算法 单源最短路径的算法最常用的是Dijkstra,些算法从时间复杂度来说为O(n^2),但是面对含有负权植的图来说就无能为力了,此时 Dellman-ford算法就有用了,这咱算法是采用的是 ...
- Ogre场景编辑器Ogitor源代码的构建
本文转自:http://blog.csdn.net/zhengkangchen/article/details/6000769 Ogitor-0.4.2源代码构建,不少时间,这里记录一下: 下载源代码 ...
- mybatis学习(四)
创建mybatis工程 工程目录: 具体步骤: 1.创建sqlMapConfig.xml文件,配置mybatis的运行环境,事物,数据源,加载mapper映射文件等. 2.创建po类(查询或者返回的属 ...
- 查询速度优化用not EXISTS 代替 not in
1,not in 速度奇慢,要用 not EXISTS ,速度奇快! 大表效果尤其明显 sql中exists,not exists的用法 exists()后面的子查询被称做相关子查询,他是不返回列表的 ...
- java:类集回顾
1.类集设置的主要目的:动态的对象数组 2.类集中有以下几个接口: Collection:是存放单值的最大父接口 |- List接口:里面的内容是允许重复的 |- ArrayList, Vector, ...
- GeoServer基础教程(二):GeoServer的Web管理界面快速入门
转载:http://blog.163.com/daimiao_study/blog/static/248923117201542522742373/ GeoServer的控制和管理是基于网页形式,所有 ...
- java - BigDecimal的format()方法和setScale()方法格式字符串
1.BigDecimal.setScale()方法用于格式化小数点 setScale(1)表示保留一位小数,默认用四舍五入方式 setScale(1,BigDecimal.ROUND_DOWN)直接删 ...