Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 自定义seekbar在thumb和progress之间存在差距_Android_Xml_Seekbar - Fatal编程技术网

Android 自定义seekbar在thumb和progress之间存在差距

Android 自定义seekbar在thumb和progress之间存在差距,android,xml,seekbar,Android,Xml,Seekbar,我已经为垂直搜索杆创建了自己的自定义样式,但是在拇指和搜索杆的进度部分之间有一个小间隙,如下所示: 但更有趣的是,拇指拖得越远,间隙就越小,直到消失时约占满50%-60%: 一切都是使用xml和形状完成的,没有PNG。你知道这是什么原因吗?我试着用不同的填充物和拇指偏移量混日子,但显然我肯定错过了什么。 下面是SeekBar、Progress Drawable和Thumb Drawable的xml。 答案在这里 <SeekBar android:layout

我已经为垂直搜索杆创建了自己的自定义样式,但是在拇指和搜索杆的进度部分之间有一个小间隙,如下所示:

但更有趣的是,拇指拖得越远,间隙就越小,直到消失时约占满50%-60%:

一切都是使用xml和形状完成的,没有PNG。你知道这是什么原因吗?我试着用不同的填充物和拇指偏移量混日子,但显然我肯定错过了什么。

下面是SeekBar、Progress Drawable和Thumb Drawable的xml。






答案在这里
<SeekBar
        android:layout_width="320dp"
        android:layout_height="wrap_content"
        android:background="@drawable/volume_shading"
        android:id="@+id/volume"
        android:rotation="270"
        android:progressDrawable="@drawable/blue_slider"
        android:paddingTop="20dp"
        android:paddingBottom="20dp"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:thumb="@drawable/thumb"
        android:thumbOffset="0dp"
        android:layout_marginTop="220dp"
        android:layout_marginRight="-100dp"
        android:layout_alignParentRight="true"/>
<?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/grey_bar" />

    <item android:id="@android:id/progress">
    <scale android:scaleWidth="100%"
           android:drawable="@drawable/blue_bar" />
    </item>

</layer-list>
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle">
    <solid android:color="@android:color/white" />
    <size  android:width="8dp"
           android:height="40dp" />
    <corners android:radius="4dp" />
</shape>