I have SeekBar with custom drawable. Progress element is not rendered from left side exactly but it is moved to right. How can I avoid this?
Observation
When you create a line using shape drawable it leaves the left and right padding (from the view in which this drawable is being used.)equal to the half of its stroke width.
Workaround
You need to wrap your progress_background with an inset drawable and then set it as progress background. The inset can be like the following-
inset_seekbar_background.xml
and your final seekbar.xml will be like-
-
Alternates
1.You can use an 9 path image for line as it is done in the default material design-
-
-
-
-
2.You can set the theme to your view with different color in android style as-
Here I have used all there options for Seekbars-
And here is the output-