Posts

Showing posts with the label Seekbar

Android Custom SeekBar - Progress Is Not Following The Thumb

Image
Answer : Your implementation relies on a ClipDrawable to draw the progress bar. The progress drawable spans the entire length of the progress bar but is shortened, or clipped, by the ClipDrawable . This leaves the rounded corners on the left of the progress bar but squares off the right side. You are seeing the squared-off side as the progress bar grows, catches up to and overtakes the thumb. There are probably several ways to solve this, but let's go for something that is XML-based. Let's replace the ClipDrawable with a ScaleDrawable as follows: bg_seekbar.xml <layer-list> <item android:id="@android:id/background"> <shape android:shape="rectangle"> <size android:height="48dp" /> <corners android:radius="25dp" /> <stroke android:width="1dp" android:color="@color/semiLightBlue" /> </shape...