这是我的搜索栏:
<SeekBar
android:id="@+id/seek1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:progressDrawable="@drawable/style_progressbar"
android:thumb="@drawable/style_progressbar_circle"
android:progress="20" />
Run Code Online (Sandbox Code Playgroud)
这是style_progressbar.xml:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape android:shape="rectangle" >
<corners android:radius="5dp" />
<gradient
android:angle="270"
android:endColor="@color/gris_hint"
android:startColor="@color/gris_hint" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="5dp" />
<gradient
android:angle="270"
android:endColor="@color/gris"
android:startColor="@color/gris" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle" >
<corners android:radius="5dp" />
<gradient
android:angle="270"
android:endColor="@color/gris"
android:startColor="@color/gris" />
</shape>
</clip>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
这是style_progressbar_circle.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/red_scrubber_control_disabled_holo" android:state_enabled="false"/>
<item android:drawable="@drawable/red_scrubber_control_pressed_holo" android:state_pressed="true"/>
<item android:drawable="@drawable/red_scrubber_control_focused_holo" android:state_selected="true"/>
<item …Run Code Online (Sandbox Code Playgroud) 我有一个带有自定义drawable的SeekBar用于Thumb,我希望能够根据我拥有的另一个控件来显示/隐藏它.
我尝试从资源加载drawable,然后使用SeekBar.setThumb()和drawable,或null.
隐藏它(设置为null),但我永远无法取回它.
我想使一个seekbar拇指完全看不见.但是,以下代码:
seekBar.getThumb().mutate().setAlpha(0);
Run Code Online (Sandbox Code Playgroud)
使拇指不出现,但拇指似乎在其搜索栏中形成一个"洞",如下图所示.
怎么能让拇指看不见而不留下它的间隙?