让android系统中任意一个view变成进度条
1.效果
2.进度条背景drawable文件
结束后可以恢复原背景.
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/background"> <shape android:layout_width="wrap_content" android:shape="rectangle"> <corners android:radius="12dp" /> <stroke android:color="#dcdcdc" android:width="1px" ></stroke> <solid android:color="#f7f7f7" /> </shape> </item> <item android:id="@+id/progressing" android:top="2px" android:right="2px" android:bottom="2px" android:left="2px"> <clip android:clipOrientation="horizontal" android:gravity="left" android:shape="rectangle"> <shape> <corners android:radius="12dp" /> <solid android:color="#fee2cd" /> </shape> </clip> </item> </layer-list>
3.更新进度
在进度更新代码里 计算出进度值pro,然后更新.
LayerDrawable ld = (LayerDrawable) view.getBackground(); ClipDrawable clipDrawable = (ClipDrawable) ld.findDrawableByLayerId(R.id.progressing); clipDrawable.setLevel( * pro);
4.下载
https://gitee.com/xi/any-view-progress.git
让android系统中任意一个view变成进度条的更多相关文章
- Linux中实现一个简单的进度条【转】
转自:http://blog.csdn.net/yuehailin/article/details/53999288 说起进度条,其实大家常常见到,比如说你在下载视频或文件的时候,提示你当前下载进度的 ...
- python中实现一个简单的进度条
import time def progress(n,a): m = int(n / a * 100) x = int(n / a * 10) time.sleep(0.2) #只是为了让进度条明显 ...
- 在Android系统中修改Android.mk使其同时编译rgb2565和rgb2888(向out/host/linux-x86/bin/下新增加一个工具命令)【转】
本文转载自:http://blog.csdn.net/mu0206mu/article/details/7514559 在Android系统中修改android.mk使其同时编译rgb2565和rgb ...
- Android系统中的广播(Broadcast)机制简要介绍和学习计划
在Android系统中,广播(Broadcast)是在组件之间传播数据(Intent)的一种机制:这些组件甚至是可以位于不同的进程中,这样它就像Binder机制一样,起到进程间通信的作用:本文通过一个 ...
- android2.3 View视图框架源码分析之一:android是如何创建一个view的?
View是所有控件的一个基类,无论是布局(Layout),还是控件(Widget)都是继承自View类.只不过layout是一个特殊的view,它里面创建一个view的数组可以包含其他的view而已. ...
- AIDL在android系统中的作用
AIDL,Android Interface definition language的缩写,它是一种android内部进程通信接口的描述语言,通过它我们可以定义进程间的通信接口.最近看了下AIDL在A ...
- [原创]Android系统中常用JAVA类源码浅析之HashMap
由于是浅析,所以我只分析常用的接口,注意是Android系统中的JAVA类,可能和JDK的源码有区别. 首先从构造函数开始, /** * Min capacity (other than zero) ...
- Android系统中是否开启定位及定位模式的判断
1.关于Android系统中不同的定位模式 Android系统中包括3中定位模式: 使用GPS.WLAN和移动网络 使用WLAN和移动网络 仅使用GPS 截图 特点 同时使用GPS.WIFI及基站 ...
- Android系统中标准Intent的使用
Android系统用于Activity的标准Intent 1.根据联系人ID显示联系人信息= Intent intent=new Intent(); intent.setAction(Intent.A ...
随机推荐
- SQL Server 时间类型转换函数
cast ( expression as data_type(length))convert ( data_type (length), expression, style) //如果未指定 leng ...
- <abbr> 元素的样式为显示在文本底部的一条虚线边框,当鼠标悬停在上面时会显示完整的文本(只要您为 <abbr> title 属性添加了文本)
<abbr title="World Wide Web">WWW</abbr><br><abbr title="Real Sim ...
- Linux 下安装Yaf扩展
1.在官网下载了yaf扩展包 yaf-3.0.3.tgz 2.开始安装yaf扩展 tar zxvf yaf-3.0.3.tgz cd yaf-3.0.3 phpize ./configure --wi ...
- MongoDB整理笔记のGUI操作
值得幸运的是,其实MongoDB也有像类似于PL/SQL一样的界面操作工具操作MongoDB. 下面就来介绍几款不同的界面工具,大家各取所需! MongoVUE 主页:http://www.mongo ...
- window中启动vs后鼠标无法移动
你停止wisptis.exe这个进程,在c:\Windows\System32下删除wispitis.exe就可以了!
- Linux 命令之chmod
立贴今日吉,不断更新,欢迎斧正,支持为感! 1. chmod --权限控制 chmod [-cfvR] [--help] [--version] mode file... 说明 : Linux/Uni ...
- 以太坊系列之十四: solidity特殊函数
solidity中的特殊函数 括号里面有类型和名字的是参数,只有类型是返回值. block.blockhash(uint blockNumber) returns (bytes32): hash of ...
- 分别实现数组所有元素相加、相乘、相与——FP 风格
var ops = { "plus": (x,y)=>x+y, "mul" : (x,y)=>x*y, "and" : (x,y ...
- Invalid App Store Icon. The App Store Icon in the asset catalog in 'xxx.app' can’t be transparent nor contain an alpha channel.
1.向appstore上传应用的时候,报了这样一个错误 ERROR ITMS-90717: "Invalid App Store Icon. The App Store Icon in th ...
- 【转】右键的 在 vs 中打开 怎么去掉
源地址:https://blog.csdn.net/weicaijiang/article/details/78818522 HKEY_CLASSES_ROOT\Directory\backgroun ...