Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.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中的自定义拇指变平_Android_Android Seekbar - Fatal编程技术网

Android seekbar中的自定义拇指变平

Android seekbar中的自定义拇指变平,android,android-seekbar,Android,Android Seekbar,我有一个带自定义拇指的自定义seekbar。我将选择器用于按下状态,问题是当我按下滑块上的拇指时,滑块会变平,并且在按下后不会恢复正常大小 我的代码: thumb.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/thumb2" android:state_pressed="true"/> &

我有一个带自定义拇指的自定义seekbar。我将选择器用于按下状态,问题是当我按下滑块上的拇指时,滑块会变平,并且在按下后不会恢复正常大小

我的代码:

thumb.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/thumb2" android:state_pressed="true"/>
    <item android:drawable="@drawable/thumb2" android:state_selected="true"/>
    <item android:drawable="@drawable/thumb1" android:state_pressed="false"/>
    <item android:drawable="@drawable/thumb1"/>
</selector>
我需要的是,当我按下拇指时,它只会更大。但结果是:

这是正常状态(未按下):

我也面临着这个问题。
    <size android:height="30dp" android:width="30dp"/>
    <stroke android:width="18dp" android:color="#882EA5DE"/>
    <solid android:color="#2EA5DE" />
    <corners android:radius="1dp" />
</shape>
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
    <size android:height="40dp" android:width="40dp"/>
    <stroke android:width="18dp" android:color="#882EA5DE"/>
    <solid android:color="#2EA5DE" />
    <corners android:radius="1dp" />
</shape>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@android:id/background"
        android:drawable="@drawable/tbackground"/>
    <item android:id="@android:id/progress">
        <clip android:drawable="@drawable/tprogress" />
    </item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
    <stroke android:width="1dp" android:color="#2EA5DE"/>
    <corners android:radius="1dp" />
</shape>
android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="-3dp"
        android:padding="0dp"
        android:progressDrawable="@drawable/tstyle"
        android:thumb="@drawable/thumb"
        android:thumbOffset="0dp" />