改善Android进度条
2015-11-23 22:33
357 查看
圆形进度条(替换默认转圈图片)
<ProgressBar style="@android:style/Widget.ProgressBar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:indeterminateDrawable="@drawable/custom_progressbar" android:indeterminateDuration="1000" />
android:indeterminateDrawable属性决定进度条动画
android:indeterminateDuration决定转圈快慢
@drawable/custom_progressbar动画定义如下:
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@mipmap/ic_custom_progress_bar" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:toDegrees="360"> </rotate>
android:drawable=”@mipmap/ic_custom_progress_bar” 此属性是进度条的图片资源
水平进度条(一般用于加载网页时显示)
<ProgressBar android:id="@+id/webview_progressbar" style="@style/progressBarHorizontal_color" android:layout_width="match_parent" android:layout_height="2dp" />
@style/progressBarHorizontal_color文件如下:
<style name="progressBarHorizontal_color" parent="android:style/Widget.Holo.ProgressBar.Horizontal"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@drawable/progress_color_horizontal</item> </style>
@drawable/progress_color_horizontal文件如下:
<?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> <shape> <corners android:radius="5dip" /> <gradient android:angle="270" android:centerColor="#ed0004" android:centerY="0.75" android:endColor="#ed0004" android:startColor="#ed0004" /> </shape> </clip> </item> </layer-list>
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析
- android searchView的关闭事件
- SourceProvider.getJniDirectories