开发者

Trouble positioning customized thumb at the centre of seekbar

I tried to change the width of seekbar and made it thin. But my thumb is not coming at the centre of seekbar. Thumb is a customised 9 patch image.

    <?xml version="1.0" encoding="utf-8"?>
<Re开发者_JAVA技巧lativeLayout 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>


I got it right by defining minHeight and maxHeight of the seekbar


After defining an attribute with big value of maxHeight:

android:maxHeight="1000dp"

SeekBar will be adjusted to the center

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜