I\'m using a drawable for seekbar thumb with
android:thumb=\"@drawable/thumb\"
How can I set the size of this thumb in dip
I work like this:
public class FlexibleThumbSeekbar extends SeekBar {
public FlexibleThumbSeekbar(Context context) {
super(context);
}
public FlexibleThumbSeekbar(Context context, AttributeSet attrs) {
super(context, attrs);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.thumb);
Bitmap thumb = Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(thumb);
canvas.drawBitmap(bitmap, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()),
new Rect(0, 0, thumb.getWidth(), thumb.getHeight()), null);
Drawable drawable = new BitmapDrawable(getResources(), thumb);
setThumb(drawable);
}
}
just a sample,in your real usage,you should define the width,height and picture of your thumb in a xml file.