List of usage examples for android.graphics.drawable GradientDrawable setSize
public void setSize(int width, int height)
Sets the size of the shape drawn by this drawable.
Note: changing this property will affect all instances of a drawable loaded from a resource.
From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java
private GradientDrawable makeTrackDrawable(int color, int thumbWidth, int thumbHeight, float radius, int padding) { GradientDrawable trackDrawable = new GradientDrawable(); if (padding > 0) { trackDrawable.setStroke(padding, Color.TRANSPARENT); }// ww w . j a v a 2 s. c o m trackDrawable.setCornerRadius(radius); trackDrawable.setSize((int) (thumbWidth * Default.DEFAULT_MEASURE_FACTOR), thumbHeight); trackDrawable.setColor(getTrackColor(color)); return trackDrawable; }
From source file:com.mixiaoxiao.support.widget.SmoothSwitch.java
private GradientDrawable makeThumbDrawable(int color, int thumbWidth, int thumbHeight, float radius, int padding) { GradientDrawable thumbDrawable = new GradientDrawable(); if (padding > 0) { thumbDrawable.setStroke(padding, Color.TRANSPARENT);//make a transparent stroke ,just like padding }//from w ww. ja v a 2 s. co m thumbDrawable.setCornerRadius(radius); thumbDrawable.setSize(thumbWidth, thumbHeight); thumbDrawable.setColor(color); return thumbDrawable; }