自定义 SeekBar 的矩形边缘
我已经使用LayeredDrawable自定义了SeekBar,可绘制工作正常,但用作背景的可绘制在角处变圆(两个角,这里只有右端)当拇指移动到最左边时,左角也变成圆角(注:原始图像是矩形)。我怎样才能把它变成矩形?
这是我的 LayerdDrawable xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<bitmap android:src="@drawable/progress_bg" />
</item>
<item android:id="@android:id/progress">
<clip>
<bitmap android:src="@drawable/progress" />
</clip>
</item>
</layer-list>
I have customize the SeekBar using a LayeredDrawable, The drawable works fine, but the drawable used as a background becomes rounded at the corners (Both the corner, here only the right end is shown. When the thumb is moved to the extreme left, the left corner is also rounded. Note: The original image is rectangular). How do I make it rectangular?
Here is my LayerdDrawable xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<bitmap android:src="@drawable/progress_bg" />
</item>
<item android:id="@android:id/progress">
<clip>
<bitmap android:src="@drawable/progress" />
</clip>
</item>
</layer-list>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从 Android 上发布的此(相关)问题中提取信息- 开发商谷歌集团。注意
。这就是您需要更改的参数。更新:到底是什么,我只是发布一些代码。 = )
您可能需要对 secondaryProgress 等执行相同的操作。
You can extract information from this (related) question posted on android-developers Google Group. Pay attention to
<corners android:radius="5dip" />
. That's the parameter you'll need to change.UPDATE: What the heck, I'll just post some code. = )
You might need to do the same thing with
secondaryProgress
and so on.