[置顶] 自定义的解压进度条 关于ProgressBar的使用
整体布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:background="@drawable/main_bg"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/decompression"
android:textColor="#436EEE"
android:textSize="15sp" /> <TextView
android:id="@+id/tv_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="10dp"
android:text="@string/current_value"
android:textColor="#EE9A00"
android:textSize="11sp" /> <ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="5dp"
android:layout_marginTop="5dp"
android:progressDrawable="@drawable/progress_bg" />
</LinearLayout> </LinearLayout>
渐变色背景
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linear_"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:background="@drawable/main_bg"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="10dp" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/decompression"
android:textColor="#436EEE"
android:textSize="15sp" /> <TextView
android:id="@+id/tv_current"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="10dp"
android:text="@string/current_value"
android:textColor="#EE9A00"
android:textSize="11sp" /> <ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="5dp"
android:layout_marginTop="5dp"
android:progressDrawable="@drawable/progress_bg" />
</LinearLayout> </LinearLayout>
ProgressBar的背景资源
分别需要对3个 item进行id 进行设置 :
android:id/background
android:id/secondaryProgress
android:id/progress
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@android:id/background">
<shape>
<corners android:radius="3dip" /> <gradient
android:angle="270"
android:centerY="0.75"
android:endColor="#30F5FFFA"
android:startColor="#90F0F0F0" />
</shape>
</item>
<!-- 设置第二级进度条颜色图像资源 -->
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="3dip" /> <gradient
android:angle="270"
android:centerY="0.75"
android:endColor="#EEE685"
android:startColor="#EEAD0E" />
</shape>
</clip>
</item>
<!-- 设置第一级进度条颜色图像资源 -->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="3dip" /> <gradient
android:angle="270"
android:centerY="0.75"
android:endColor="#3087CEEB"
android:startColor="#906495ED" />
</shape>
</clip>
</item> </layer-list>
gradient的几种属性配置:
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track" //滚动条背景
android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb" //滚动条 scrollbar_vertical_track.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#3333FF" android:endColor="#8080FF"
android:angle="0"/>
<corners android:radius="6dp" />
</shape> scrollbar_vertical_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#505050" android:endColor="#C0C0C0"
android:angle="0"/>
<corners android:radius="0dp" />
</shape>
[置顶] 自定义的解压进度条 关于ProgressBar的使用的更多相关文章
- 进度条(Progressbar)
进度条(Progressbar) 提供如下一些样式改变进度条的外观 @android:style/Widget.ProgressBar.Horizontal(水平进度条) @android:style ...
- 一个利用 Parallel.For 并行处理任务,带有进度条(ProgressBar)的 WinForm 实例(下)
接着上一篇:一个利用 Parallel.For 并行处理任务,带有进度条(ProgressBar)的 WinForm 实例(上) 直接贴代码了: using System; using System. ...
- Android自定义一款带进度条的精美按键
Android中自定义View并没有什么可怕的,拿到一个需要自定义的View,首先要做的就是把它肢解,然后思考每一步是怎样实现的,按分析的步骤一步一步的编码实现,最后你就会发现达到了你想要的效果.本文 ...
- Android 自定义漂亮的圆形进度条
公司有这样一个需求,实现这个圆弧进度条 所以,现在就将它抽取出来分享 如果需要是圆帽的就将,下面这句代码放开即可 mRingPaint.setStrokeCap(Paint.Cap.ROUND);// ...
- Android 进度条(ProgressBar)和拖动条(Seekbar)补充“自定义组件”(总结)
这周结束了,我也码了一周的字,感觉还是很有种脚踏实地的感觉的,有时间就可以看看自己的总结再查漏补缺,一步一个脚印,做出自己最理想的项目. 今天我们讲两点: 1.ProgressBar: 其实前面也稍微 ...
- 详解Bootstrap进度条组件
在网页中,进度条的效果并不少见,如:平分系统.加载状态等,进度条组件使用了css3的transition和animation属性来完成一些特效,这些特效在IE9及IE9以下版本.Firefox的老版本 ...
- android之进度条组件ProgressBar
首先是main.xml文件 代码如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android& ...
- 7.进度条(ProgressBar)
默认为圆形,类似加载的样子,如果想要设置为下载的样式,可以选择它的样式为横向. style="?android:attr/progressBarStyleHorizontal" 顺 ...
- 进度条(ProgressBar)的功能与用法
进度条也是UI界面中一种非常实用的组件,通常用于向用户显示某个耗时操作完成的的百分比.进度条可以动态的显示进度,因此避免长时间的执行某个耗时的操作,让用户感觉程序失去了响应,从而更好的提高用户界面的友 ...
随机推荐
- Python 序列与映射的解包操作
解包就是把序列或映射中每个元素单独提取出来,序列解包的一种简单用法就是把首个或前几个元素与后面几个元素分别提取出来,例如: first, seconde, *rest = sequence 如果seq ...
- join和 Daemon守护线程
一.前言 一个程序至少有一个主线程,主线程启动子线程后,它们之间并没有隶属关系.主线程和子线程执行是并行的,相互独立.主线程执行完毕后默认不等子线程执行结束就接着往下走了,如果有其他程序就会运行另外的 ...
- Navicat Premium 激活码 序列号。破解版。
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha Navicat Premium 激活码 序列号.破解版.
- Codeforces Round #502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2) G. The Tree
G. The Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input o ...
- bzoj 4242 水壶 (多源最短路+最小生成树+启发式合并)
4242: 水壶 Time Limit: 50 Sec Memory Limit: 512 MBSubmit: 1028 Solved: 261[Submit][Status][Discuss] ...
- kali下利用weeman进行网页钓鱼
工具下载链接:https://files.cnblogs.com/files/wh4am1/weeman-master.zip 利用wget命令下载zip压缩包 利用unzip命令解压 接着直接cd进 ...
- hdu 4463 第37届ACM/ICPC杭州赛区K题 最小生成树
题意:给坐标系上的一些点,其中有两个点已经连了一条边,求最小生成树的值 将已连接的两点权值置为0,这样一定能加入最小生成树里 最后的结果加上这两点的距离即为所求 #include<cstdio& ...
- FindWindow和FindWindowEx
函数原型:FindWindow(lpszClassName,lpszWindowName) 参数:lpszClassName--窗口类名;lpszWindowName--窗口标题 功能:查找窗口,未找 ...
- UVALive 5971
Problem J Permutation Counting Dexter considers a permutation of first N natural numbers good if it ...
- 华为S5300系列升级固件S5300SI-V100R006C00SPC800.cc
这个固件附带了web,V100R005可以直接升级到这个版本,但没什么必要,因为V100R005本身可以直接升级到V200. 升级小插曲: 1.升级的使用使用Windows,不要用Mac或者Linux ...