I have to make a seekbar where i can change almost everything programmatically. And now I\'m having a problem to change the thumb and the bar size. Everything works great if
well, too bad there were no responses but i was able to answer the question myself. The answer is to use InsetDrawable. You have to put the one of the drawables of the bar into a InsetDrawable.
Thats the code:
public void setSeekBarProgress(int width, int height, int rColor, int gColor, int bColor){
GradientDrawable shape2 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.WHITE,Color.rgb(rColor, gColor, bColor)});
shape2.setCornerRadius(50);
ClipDrawable clip = new ClipDrawable(shape2, Gravity.LEFT,ClipDrawable.HORIZONTAL);
GradientDrawable shape1 = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{Color.WHITE, getResources().getColor(R.color.DimGray)});
shape1.setCornerRadius(50);//change the corners of the rectangle
InsetDrawable d1= new InsetDrawable(shape1,5,5,5,5);//the padding u want to use
LayerDrawable mylayer = new LayerDrawable(new Drawable[]{d1,clip});
seekbar.setProgressDrawable(mylayer);
seekbar.setProgress(50);
}
I hope this can help someone else with the same problem.