Android - 造型搜索栏
我想设计一个看起来像下图中的搜索条。
通过使用默认搜索条,我将得到这样的东西:
所以我需要的是只改变颜色。我不需要额外的款式。有没有直接的方法来做这个或我应该建立我的自定义drawable。?
我尝试构建自定义的一个,但我无法得到如上所示的确切的一个。使用自定义drawable后,我得到的如下所示:
如果我需要构建自定义的那个,那么请建议如何减少进度线的宽度以及形状。
我的自定义实现:
background_fill.xml:
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient android:angle="90" android:centerColor="#FF555555" android:endColor="#FF555555" android:startColor="#FF555555" /> <corners android:radius="1dp" /> <stroke android:width="1dp" android:color="#50999999" /> <stroke android:width="1dp" android:color="#70555555" /></shape>
progess_fill.xml
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" > <gradient android:angle="90" android:centerColor="#FFB80000" android:endColor="#FFFF4400" android:startColor="#FF470000" /> <corners android:radius="1dp" /> <stroke android:width="1dp" android:color="#50999999" /> <stroke android:width="1dp" android:color="#70555555" /></shape>
progress.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" android:drawable="@drawable/background_fill"/> <item android:id="@android:id/progress"> <clip android:drawable="@drawable/progress_fill" /> </item></layer-list>
thumb.xml
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <gradient android:angle="270" android:endColor="#E5492A" android:startColor="#E5492A" /> <size android:height="20dp" android:width="20dp" /></shape>
宝慕林4294392
相关分类