我必须为Android创建SeekBar样式,并且无法弄清楚如何执行此操作。这是最终结果的图片(我希望达到)。Android SeekBar定制
让我们开始与搜索栏的背景。我试图将它分成三部分:左侧圆形结束,中间部分的可重复部分和右侧圆形结束。并且它们应该与下一个代码(foo_background.xml)结合。
<?xml version="1.0" encoding="utf-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:clipOrientation="horizontal" >
<bitmap
android:antialias="true"
android:dither="false"
android:filter="false"
android:gravity="left|center_vertical"
android:src="@drawable/foo_left"
android:tileMode="disabled" />
<bitmap
android:antialias="true"
android:dither="false"
android:filter="false"
android:gravity="center_vertical"
android:src="@drawable/foo_middle"
android:tileMode="repeat" />
<bitmap
android:antialias="true"
android:dither="false"
android:filter="false"
android:gravity="right|center_vertical"
android:src="@drawable/foo_right"
android:tileMode="disabled" />
</clip>
这是SeekBar的背景可绘制文件中使用。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<clip android:drawable="@drawable/foo_background" />
</item>
<item android:id="@android:id/progress">
<clip android:drawable="@drawable/seek_bar_progress" />
</item>
</layer-list>
但由于所有这些东西的结果我看到一个空的(或更好的说,我没有看到它)搜索栏进度线。
有没有人知道如何以正确的方式做到这一点? 非常感谢您的帮助。
您可以观看链接教程http://webtutsdepot.com/2011/12/03/ android-sdk-tutorial-seekbar-example/ –