public class

RoundedColorDrawable

extends Drawable
implements Rounded
java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ com.facebook.drawee.drawable.RoundedColorDrawable

Summary

Public Constructors
RoundedColorDrawable(int color)
Creates a RoundedColorDrawable.
RoundedColorDrawable(float[] radii, int color)
Creates a new instance of RoundedColorDrawable.
RoundedColorDrawable(float radius, int color)
Creates a new instance of RoundedColorDrawable.
Public Methods
void draw(Canvas canvas)
static RoundedColorDrawable fromColorDrawable(ColorDrawable colorDrawable)
Creates a new instance of RoundedColorDrawable from the given ColorDrawable.
int getAlpha()
Returns the drawable's alpha value.
int getBorderColor()
Gets the border color.
float getBorderWidth()
Gets the border width.
int getColor()
Gets the color.
int getOpacity()
Returns the opacity of the final color which would be used for drawing.
float getPadding()
Gets the padding.
boolean getPaintFilterBitmap()
Gets whether to set FILTER_BITMAP_FLAG flag to Paint.
float[] getRadii()
Gets the radii.
boolean getScaleDownInsideBorders()
Gets whether image should be scaled down inside borders.
boolean isCircle()
Returns whether or not this drawable rounds as circle.
void setAlpha(int alpha)
Sets the drawable's alpha value.
void setBorder(int color, float width)
Sets the border
void setCircle(boolean isCircle)
Sets whether to round as circle.
void setColor(int color)
Sets the color.
void setColorFilter(ColorFilter colorFilter)
Setting a color filter on a ColorDrawable has no effect.
void setPadding(float padding)
void setPaintFilterBitmap(boolean paintFilterBitmap)
Sets FILTER_BITMAP_FLAG flag to Paint.
void setRadii(float[] radii)
Sets the rounding radii.
void setRadius(float radius)
Sets the rounding radius.
void setScaleDownInsideBorders(boolean scaleDownInsideBorders)
Sets whether image should be scaled down inside borders.
Protected Methods
void onBoundsChange(Rect bounds)
[Expand]
Inherited Methods
From class android.graphics.drawable.Drawable
From class java.lang.Object
From interface com.facebook.drawee.drawable.Rounded

Public Constructors

public RoundedColorDrawable (int color)

Creates a RoundedColorDrawable.

Parameters
color of the drawable

public RoundedColorDrawable (float[] radii, int color)

Creates a new instance of RoundedColorDrawable.

Parameters
radii Each corner receive two radius values [X, Y]. The corners are ordered top-left, top-right, bottom-right, bottom-left.
color of the drawable

public RoundedColorDrawable (float radius, int color)

Creates a new instance of RoundedColorDrawable.

Parameters
radius of the corners in pixels
color of the drawable

Public Methods

public void draw (Canvas canvas)

public static RoundedColorDrawable fromColorDrawable (ColorDrawable colorDrawable)

Creates a new instance of RoundedColorDrawable from the given ColorDrawable.

Parameters
colorDrawable color drawable to extract the color from
Returns
  • a new RoundedColorDrawable

public int getAlpha ()

Returns the drawable's alpha value.

Returns
  • A value between 0 and 255.

public int getBorderColor ()

Gets the border color.

public float getBorderWidth ()

Gets the border width.

public int getColor ()

Gets the color.

Returns
  • color

public int getOpacity ()

Returns the opacity of the final color which would be used for drawing. This has been inspired by Android ColorDrawable.

Returns
  • the opacity

public float getPadding ()

Gets the padding.

public boolean getPaintFilterBitmap ()

Gets whether to set FILTER_BITMAP_FLAG flag to Paint.

public float[] getRadii ()

Gets the radii.

public boolean getScaleDownInsideBorders ()

Gets whether image should be scaled down inside borders.

public boolean isCircle ()

Returns whether or not this drawable rounds as circle.

public void setAlpha (int alpha)

Sets the drawable's alpha value.

Parameters
alpha The alpha value to set, between 0 and 255.

public void setBorder (int color, float width)

Sets the border

Parameters
color of the border
width of the border

public void setCircle (boolean isCircle)

Sets whether to round as circle.

Parameters
isCircle whether or not to round as circle

public void setColor (int color)

Sets the color.

public void setColorFilter (ColorFilter colorFilter)

Setting a color filter on a ColorDrawable has no effect. This has been inspired by Android ColorDrawable.

Parameters
colorFilter Ignore.

public void setPadding (float padding)

public void setPaintFilterBitmap (boolean paintFilterBitmap)

Sets FILTER_BITMAP_FLAG flag to Paint. FILTER_BITMAP_FLAG

This should generally be on when drawing bitmaps, unless performance-bound (rendering to software canvas) or preferring pixelation artifacts to blurriness when scaling significantly.

Parameters
paintFilterBitmap whether to set FILTER_BITMAP_FLAG flag to Paint.

public void setRadii (float[] radii)

Sets the rounding radii.

Parameters
radii Each corner receive two radius values [X, Y]. The corners are ordered top-left, top-right, bottom-right, bottom-left

public void setRadius (float radius)

Sets the rounding radius.

public void setScaleDownInsideBorders (boolean scaleDownInsideBorders)

Sets whether image should be scaled down inside borders.

Protected Methods

protected void onBoundsChange (Rect bounds)