如何创建自定义搜索栏并进行优化?

时间:2014-09-29 07:16:11

标签: android android-custom-view custom-view android-seekbar

我尝试创建这样的自定义搜索栏:http://i.stack.imgur.com/8B0Q8.png

但我遇到了这个问题的问题:http://i.stack.imgur.com/rcQG7.png

我使用此项目动态更改文本:github.com/Amit-Gupta26/AndroidCustomSeekBar

我的布局代码在这里:

 <RelativeLayout
 android:id="@+id/layout_seekbar"
 android:layout_width="match_parent"
 android:layout_height="0dp"
 android:layout_weight="1"
 android:background="@drawable/seekbar_bg" >

 <SeekBar
     android:id="@+id/seekbar"
     style="@style/CustomSeekBar"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_alignParentLeft="false"
     android:layout_alignParentTop="false"
     android:layout_centerHorizontal="true"
     android:layout_centerVertical="true" />

我尝试了很多不同的方法。但我无法在所有屏幕上实现稳定性。 怎么办呢?

2 个答案:

答案 0 :(得分:0)

我认为这篇文章会对你有所帮助:

Custom Seekbar

您还需要使用9patch图像

答案 1 :(得分:0)

在查看您遇到的问题之后,我认为您的问题不在于如何创建自定义搜索栏,而是如何单独控制拇指大小和条形尺寸,例如使thimb更大而不必制作条形图或结局很大,我看到你必须看看herehere以及here

相关问题