自定义搜索栏矩形边缘 [英] Rectangular edges for custom SeekBar

查看:205
本文介绍了自定义搜索栏矩形边缘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义的搜索栏使用的 LayeredDrawable ,用作背景变成在角(两个角落,这里只圆形的绘制工作正常,但绘制。右端显示当拇指移动到左端,左侧角球也圆形注:原图像的矩形)。我如何选择矩形?

下面是我的LayerdDrawable的xml:

 < XML版本=1.0编码=UTF-8&GT?;
<层列表的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android>
<项目机器人:ID =@机器人:ID /背景>
    <位图机器人:SRC =@可绘制/ progress_bg/>
< /项目>
<项目机器人:ID =@机器人:ID /进步>
    <夹>
        <位图机器人:SRC =@可绘制/进步/>
    < /剪辑>
< /项目>
< /层列表>
 

解决方案

您可以从的这个张贴在Android的开发商谷歌集团(相关的)问题。注意<边角机器人:半径=5dip/> 。这就是你需要更改的参数。

更新:哎呀,我只是张贴一些什么code。 =)

 <项目机器人:ID =@机器人:ID /进步>
    <夹>
        <形状>
            <边角机器人:半径=0dip/>
        < /形状>
    < /剪辑>
< /项目>
 

您可能需要做同样的事情与 secondaryProgress 等等。

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>

解决方案

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. = )

<item android:id="@android:id/progress">
    <clip>
        <shape>
            <corners android:radius="0dip" />
        </shape>
    </clip>
</item> 

You might need to do the same thing with secondaryProgress and so on.

这篇关于自定义搜索栏矩形边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆