Progressbar覆盖不全是圆角的问题
来源:互联网 发布:555是什么意思网络用语 编辑:程序博客网 时间:2024/04/28 23:14
这里遇到一个就是自定义水平进度条样式的问题,就是覆盖在上层的进度不能显示圆角。
我们想要实现的效果是如下图的样子的。后来发现原因就是我们用了用了clip属性来切割图片,被clip切了所以变成了直角,所以我们不用clip标签改为scale这个标签就完美解决了。实现效果如下图:
1.xml中的引用:
<ProgressBar android:id="@+id/progress_count" style="@style/mProgress_horizontal" android:layout_width="match_parent" android:layout_height="36px" android:layout_marginLeft="35px" android:layout_marginRight="35px" android:layout_marginTop="36px" android:progress="0" android:secondaryProgress="50" />
2.style中的代码:
<!--自定义水平进度条--> <style name="mProgress_horizontal"> <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@drawable/progressbar_horizontal </item><!-- progress_horizontal --> <item name="android:indeterminateDrawable"> @android:drawable/progress_indeterminate_horizontal </item> </style>
3.关键就是这个android:progressDrawable的属性了,progressbar_horizontal的代码
<?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="50dip" /> <gradient android:angle="270" android:centerColor="@color/progressbg" android:centerY="0.75" android:endColor="@color/progressbg" android:startColor="@color/progressbg" /> </shape> </item> <item android:id="@android:id/secondaryProgress"> <scale android:scaleWidth="100%"> <shape> <corners android:radius="50dip" /> <gradient android:angle="270" android:centerY="0.75" android:endColor="@color/textorange" android:startColor="@color/orange" /> </shape> </scale> </item> <item android:id="@android:id/progress"> <scale android:scaleWidth="100%"> <shape> <corners android:radius="50dip" /> <gradient android:angle="270" android:centerY="0.75" android:endColor="@color/textorange" android:startColor="@color/orange" /> </shape> </scale> </item></layer-list>
可以看到的是我们只是吧<clip/>标签内容替换为<scale android:scaleWidth="100%">就可以了。或许.9图也是可以实现的,scale标签顾名思义就是拉伸的意思。。。不会切割。
总结:开心,开心就好。。。
0 0
- Progressbar覆盖不全是圆角的问题
- ProgressBar使用自定义drawable时,进度显示不全的问题
- radiolog不全的问题
- progressbar的相关问题
- 常见字体显示不全、图片上文字覆盖等问题
- GridPanel显示不全的问题
- ScrollView显示不全的问题
- Win7 桌面覆盖不全
- Android-自定义Actionbar左侧覆盖不全的bug修复
- Android——自定义Actionbar左侧覆盖不全的解决方案
- 关于ProgressBar的美化问题
- 关于ProgressBar的美化问题
- RatingBar在真机上显示不全的问题
- 解决GridView显示不全的问题
- 解决TrackPopupMenu显示菜单不全的问题
- nginx+fastcgi文件下载不全的问题
- qtp菜单显示不全的问题
- libcurl下载数据不全的问题
- Linux平台搭建Jenkins+Maven+Shell实现自动化构建部署
- NYOJ 524 A-B Problem(java)
- swift学习笔记(1)-基础语法
- 前台js将<>换成转意符
- oracle批量导出sequence
- Progressbar覆盖不全是圆角的问题
- iOS开发断点调试高级技巧
- 【CSS】自定义上传文件按钮
- LagomFramework介绍(一)
- Android五大布局,四大组件,五种存储方式,activity四种启动模式
- CentOS7安装LNMP+Mongodb环境
- 图像识别(11)——LED灯光点捕获+基于QT平台绘制轨迹(1)
- Maven本地环境搭建
- Swift的学习总结