自定义加载进度条loading的几种方式
1.
<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android"><item android:duration="150" android:drawable="@drawable/loading_01" /><item android:duration="150" android:drawable="@drawable/loading_02" /><item android:duration="150" android:drawable="@drawable/loading_03" /><item android:duration="150" android:drawable="@drawable/loading_04" /><item android:duration="150" android:drawable="@drawable/loading_05" /><item android:duration="150" android:drawable="@drawable/loading_06" /><item android:duration="150" android:drawable="@drawable/loading_07" />
</animation-list>
activity中用法
public class AfActivity extends Activity implements OnClickListener {private ImageView imageView;private Button moveButton;public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);imageView = (ImageView) findViewById(R.id.iv_imagemove);moveButton = (Button) findViewById(R.id.move);moveButton.setOnClickListener(this);}public void onClick(View v) {// 得到配置文件中的背景文件28imageView.setBackgroundResource(R.drawable.progress_m);AnimationDrawable animationDrawable = (AnimationDrawable) imageView.getBackground();animationDrawable.start();}
}
3.一张图片
<rotate xmlns:android="http://schemas.android.com/apk/res/android"android:drawable="@drawable/spinner_black_16"android:pivotX="50%"android:pivotY="50%"android:fromDegrees="0"android:toDegrees="360" />
4.多张图标水平进度条
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 设置背景色图像资源 --> <item android:id="@android:id/background" android:drawable="@drawable/bg" /> <!-- 设置第二级进度条颜色图像资源 --> <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/secondary" /> <!-- 设置第一级进度条颜色图像资源 --> <item android:id="@android:id/progress" android:drawable="@drawable/progress" />
</layer-list> style="?android:attr/progressBarStyleHorizontal" 定义ProgressBar为水平类型
5.水平进度条
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@android:id/background"
android:drawable="@drawable/footer_navigation"/>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:angle="270"
android:centerColor="#FFFF8C00"
android:centerY="0.75"
android:endColor="#FF6611"
android:startColor="#FFFFD980" />
</shape>
</clip>
</item>
</layer-list>
6.新浪图标加载
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/progress" >
<clip
android:clipOrientation="vertical"
android:gravity="bottom" >
<shape >
<gradient
android:angle="90"
android:centerColor="#55000000"
android:centerX="0.75"
android:endColor="#55000000"
android:startColor="#55000000" />
</shape>
</clip>
</item>
</layer-list>
代码中 <clip android:clipOrientation="vertical" android:gravity="bottom" >表示进度条方向为竖直向上。 布局中引用即可
<ProgressBar
android:id="@+id/load_pb"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="109dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:background="@drawable/bkg_pic_clicktoload"
android:max="100"
android:progress="0"
android:progressDrawable="@drawable/loading_pb_drawable" />
2.建立如下一个drawable或者anim文件
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"android:fromDegrees="0"android:pivotX="50%"android:pivotY="50%"android:toDegrees="360" ><shapeandroid:innerRadiusRatio="3"android:shape="ring"android:thicknessRatio="8"android:useLevel="false" ><gradientandroid:centerColor="#043233"android:centerY="0.5"android:endColor="#000000"android:startColor="#ffffff"android:type="sweep"android:useLevel="false" /></shape>
</rotate>
自定义加载进度条loading的几种方式相关推荐
- Android 下载进度条, 自定义加载进度条,loading动画
1.自定义loadingline动画 /*** 作者:created by meixi* 邮箱:13164716840@163.com* 日期:2018/9/6 10*/public class Lo ...
- 浅谈前端实现页面加载进度条以及 nprogress.js 的实现
以前在 Vue 的项目用了 nprogress 这个插件,一直对于其如何得知加载进度充满好奇,最近又看到了「前端如何实现页面加载进度条」这个问题,今天周六恰好一探究竟.以下仅为一家之言,如有异议,欢迎 ...
- Threejs系列--18游戏开发--沙漠赛车游戏【loading资源加载进度条】
Threejs系列--18游戏开发--沙漠赛车游戏[loading资源加载进度条] 序言 目录结构 代码一览 AreaFloorBorderBufferGeometry.js代码 AreaFloorB ...
- html5 圆形加载进度条,纯css3超酷圆形Loading加载进度条特效
这是一款效果炫酷的纯css3圆形Loading加载进度条特效插件.该loading特效使用:before和:after伪元素来制作动画d的不同部分,然后给他们设置absolute定位和CSS tran ...
- android 自定义view 加载图片,Android自定义View基础开发之图片加载进度条
学会了Paint,Canvas的基本用法之后,我们就可以动手开始实践了,先写个简单的图片加载进度条看看. 按照惯例,先看效果图,再决定要不要往下看: 既然看到这里了,应该是想了解这个图片加载进度条了, ...
- CSS3超酷网页Loading加载进度条动画效果
在jQuery之家上发现的一款css3效果. CSS3 animation超酷网页Loading加载进度条动画效果 >>查看演示 > ...
- WKWebView Safari调试、JS互调、加载进度条、JS中alert、confirm、prompt
主要内容 Safari调试 swift/OC与JS互调 增加加载进度条 支持JS中alert.confirm.prompt Safari调试 设置 -> safari --> 高级,开启J ...
- Vue项目实战06:nprogress页面加载进度条
博客: https://lvsige.top/ nprogress页面加载进度条 前言 很多时候在访问网页的时候我们总是看到页面在加载中,可以却不知道要加载多久,无期限的等待总是让人烦躁不安,所以我们 ...
- iview地区加载_LoadingBar 加载进度条
LoadingBar 加载进度条 概述 全局创建一个显示页面加载.异步请求.文件上传等的加载进度条. 说明 LoadingBar 只会在全局创建一个,因此在任何位置调用的方法都会控制这同一个组件.主要 ...
最新文章
- c语言 字母 八进制表示'/1011',C语言C语言第一课:C语言概述为什么学习C语言怎样学习C语言.DOC...
- mysql 5.5 5.6差异,MySQL5.5和MySQL5.6授权区别
- mysql 自增模式 auto,mysql(AUTO_INCREMENT)自增ID的起始值修改与设置
- table 首先冻结_首先记录异常的根本原因
- 【渝粤教育】国家开放大学2019年春季 3717天然气管道长输技术 参考试题
- 遇见未来 | 超融合如何兼顾企业的“敏态”和“稳态”的业务需求
- 犀牛Rhinoceros 7 for Mac(三维建模软件)
- Linux时间子系统之七:定时器的应用--msleep(),hrtimer_nanosleep()
- Apache的目录结构详细讲解
- 【转】RIS/PACS系统实施过程中Worklist的配置与调试
- 使用base64格式生成图片
- R语言医学数据分析实战(一)数据结构与获取数据集
- 3西格玛计算公式_3西格玛的计算原理是什么?为什么用它来衡量品质的好坏?...
- 推荐:3个Python好用的PDF库
- ios dev关闭双重认证_iOS Dev Academy简短介绍(自动布局)
- 《创业基础》创新创业章节测试【3-8】
- android 5.1感叹号,关于5.1 WIFI显示感叹号
- 三十岁仍一事无成,一个失败工程师的自白
- 【SpringBoot项目实战+思维导图】瑞吉外卖①(项目介绍、开发环境搭建、后台登陆/退出功能开发)
- CT图像之Hu值变换与窗宽窗位调整
热门文章
- android编译时出现cannot find symbol
- 单细胞论文记录(part6)--SpaGE: Spatial Gene Enhancement using scRNA-seq
- Android KEYCODE键值
- Python实现经典网络架构Googlenet代码
- OPPOa73是Android10吗,上手10个月的oppo A73到底如何,大家一起来说说
- linux查看php服务,linux如何查看服务
- gitlab国内镜像和一些注意事项
- 解决运行Xcode模拟器时的慢动作【Slow Animation】
- 【独家正版】最新网盘源码-城通网盘仿蓝奏云修复版源码 完整测试可用无BUG 有问题全额退
- 今天开通了cnblog