syedowaisali / crystal-range-seekbar

537 stars 164 forks source link

Drawable XML feature availability #118

Open ritesh94 opened 6 years ago

ritesh94 commented 6 years ago

@syedowaisali Thanks for a wonderful RangeSeekbar. After going through issues in this repository, in #14 you said the drawable feature will be available soon. Any idea on the availability of the feature? Or for the meantime can you tell me any workaround to set drawable xml as thumbs?

YudiH commented 5 years ago

I've found a way to set your own custom thumbs. The clue was from the fact that setLeftThumbDrawable and setRightThumbDrawable accepts BitmapDrawable. I use Android Studio, and I did it by creating an Image Asset instead of Vector Asset. ...then setting the thumb images to that.

For example:

                app:left_thumb_image="@mipmap/ic_thumb"
                app:right_thumb_image="@mipmap/ic_thumb"
                app:left_thumb_image_pressed="@mipmap/ic_thumb_pressed"
                app:right_thumb_image_pressed="@mipmap/ic_thumb_pressed"

I believe they reside in the same folder as when you would create the launcher icon for your app (folder's called "mipmap")

If you want to change the thumb diameter to be smaller, just make an Image Asset with more padding and vice versa. the app:thumb_diameter wouldn't work for some reason. thumb_color_pressed won't do anything either, which I also solved by just setting the image_pressed to a second Image Asset that just has a different color. Works pretty well.

IMPORTANT!, for these settings to be available, I believe you need the latest version which has not been updated by the owner I think. Refer to #126 for newest version.