Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set custom drawable for thumb? #86

Open
drunkendaddy opened this issue Mar 12, 2018 · 3 comments
Open

How to set custom drawable for thumb? #86

drunkendaddy opened this issue Mar 12, 2018 · 3 comments

Comments

@drunkendaddy
Copy link

I tried:

slider.getThumb(0).setThumb(ContextCompat.getDrawable(getContext(),
                R.drawable.slider_thumb_bg));
slider.getThumb(1).setThumb(ContextCompat.getDrawable(getContext(),
                R.drawable.slider_thumb_bg));

but not working. thumb is not showing.

@bmx666
Copy link
Contributor

bmx666 commented Mar 14, 2018

@Kelvao
Copy link

Kelvao commented Nov 29, 2018

just use android:thumb="@drawable/your_drawable" in xml

@Syjgin
Copy link

Syjgin commented Mar 25, 2019

Is it possible to use, for example, gradient image as a source for thumb?
I was trying to set
<?xml version="1.0" encoding="utf-8"?> <shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="@color/age_select_start" android:centerColor="@color/age_select_middle" android:endColor="@color/age_select_end"/> </shape>
But, when I tried to set for v21 as follows:
`

<item
    android:id="@+id/pressed"
    android:drawable="@drawable/thumb_age_internal_drawable"
    android:state_pressed="true"/>
<item
    android:id="@+id/unpressed"
    android:drawable="@drawable/thumb_age_internal_drawable"/>
<!--<transition
    android:drawable="@drawable/multislider_thumb_unpressed_to_pressed_animation"
    android:fromId="@+id/unpressed"
    android:toId="@+id/pressed"/>
<transition
    android:drawable="@drawable/multislider_thumb_pressed_to_unpressed_animation"
    android:fromId="@+id/pressed"
    android:toId="@+id/unpressed"/>-->

`
any images just disappeared. Can you provide example how to use custom drawable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants