I have build a custom seekbar for my android app.
however I have difficulties tweeking the handle\\thumb size and position
as I think the attrubutes refer to the whole control and I didn't see xml attributes refering to the thumb itself.
Is there any xml way to set the thumb (1)position (2)size and (3) padding?
I have thought maybe doing it via code, but I'm not sure how and I think this is less preferable
pseoudo code like:
Drawable image = getResources().getDrawable(
R.drawable.pressed_state).setHight(20dp);
//how to set right padding?
myZoomBar.setThumb(image );
The thumb drawable used in the SeekBar class is Not a stretchable 9Patch. It is a straight forward png.
If you want a re-sizable thumb, either:
or
Note: "Padding" sets the internal spacing used for any content of a view. Padding in the Thumb Drawable doesn't actually make sense unless you are trying to display something inside the Thumb. The padding of the SeekBar defines the spacing around the outside of the Thumb and Track.
As you would know, you can: - Use the android:progress
attribute inherited from ProgressBar to set progress (thumb position) - Use the attributes inherited from View to adjust padding and size of the SeekBar.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.