搜索栏进度自定义
使用 Progress_horizontal.xml 作为我的搜索栏的基础可绘制对象,我能够很好地自定义它。但不幸的是我遇到了以下问题。我需要从两条不同颜色的水平线取得进度,如下所示 http://picasaweb .google.com/manigoad/Other#5442553107070487330。在本例中,有一条蓝线和其下方的透明线。
那么我怎样才能用两种不同的颜色取得进步呢? 特纳克斯
Using progress_horizontal.xml as a base drawable for my seekbar i was able to customize it pretty well. But unfortunately i stuck with the following problem. I need my progress to be made from two horizontal lines with different color something like this http://picasaweb.google.com/manigoad/Other#5442553107070487330 . In this case a blue line and transparent line below it.
So how can i make my progress to be made from two different colors.
Tnaks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经研究过使用“可绘制”XML 创建您正在寻找的形状“堆栈”,但填充/高度值似乎被忽略。
我能想到两种可能的解决方法:
创建一个为背景和进度实现
Drawable
的类,并自己绘制自定义颜色/渐变。-或者-
从模型中创建背景(右侧)和进度(左侧)的 PNG。大约 30 像素宽应该没问题(如果将它们设为 1 像素宽,则会对布局造成更大压力,因为必须重复更多次)。将它们放入 res/drawable/ 中,然后使用
将它们加载到您的样式中:I've had a look into creating the "stack" of shapes that you are looking for using "drawable" XML, but the padding/height values seem to be ignored.
There are two possible workarounds that I can think of:
Create a class that implements
Drawable
for the background and the progress and draw the custom colours/gradients yourself.-OR-
Create a PNG of the background (on the right) and progress (on the left) from your mockups. About 30px wide should be fine (if you make them 1px wide, it will be put more pressure on the layout because it has to be repeated more times). Throw those in res/drawable/ and then load them into your styles using
<bitmap>
: