将定制拇指定位于seekbar中心的问题
问题描述:
我试图改变seekbar的宽度并使其变薄。但我的拇指不在seekbar的中心。 Thumb是一个自定义的9个补丁映像。将定制拇指定位于seekbar中心的问题
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relLayout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<SeekBar
android:paddingLeft="60dp"
android:progressDrawable="@drawable/seekbar_progress"
android:progress="0"
android:layout_height="20dp"
android:layout_width="fill_parent"
android:id="@+id/frequency_slider"
android:max="1"
android:paddingRight="60dp"
android:minWidth="60dp"
android:minHeight="60dp"
android:layout_alignParentRight="true"
android:thumb="@drawable/seek_normal_thumb" >
</SeekBar>
</RelativeLayout>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webkit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/relLayout"
android:layout_alignParentTop="true"
/>
</RelativeLayout>
答
我这样做是正确定义了minHeight和maxHeight搜索条
+0
我只需要设置maxHeight。 :)至于如何设置它:我只是试验了不同的dp值,直到它看起来正确。 – Chani 2013-02-20 21:10:40
+0
对我来说这是android:maxHeight =“60dp”。真酷!谢谢 – 2014-12-16 12:03:53
请发布整个XML布局 – Rejinderi 2011-05-21 13:00:23