PaintDrawable

public class PaintDrawable
extends ShapeDrawable

java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ android.graphics.drawable.ShapeDrawable
       ↳ android.graphics.drawable.PaintDrawable


Drawable that draws its bounds in the given paint, with optional rounded corners.

Summary

Inherited XML attributes

Public constructors

PaintDrawable()
PaintDrawable(int color)

Public methods

void setCornerRadii(float[] radii)

Specify radii for each of the 4 corners.

void setCornerRadius(float radius)

Specify radius for the corners of the rectangle.

Protected methods

boolean inflateTag(String name, Resources r, XmlPullParser parser, AttributeSet attrs)

Subclasses override this to parse custom subelements.

Inherited methods

Public constructors

PaintDrawable

Added in API level 1
public PaintDrawable ()

PaintDrawable

Added in API level 1
public PaintDrawable (int color)

Parameters
color int

Public methods

setCornerRadii

Added in API level 1
public void setCornerRadii (float[] radii)

Specify radii for each of the 4 corners. For each corner, the array contains 2 values, [X_radius, Y_radius]. The corners are ordered top-left, top-right, bottom-right, bottom-left

Parameters
radii float: the x and y radii of the corners

setCornerRadius

Added in API level 1
public void setCornerRadius (float radius)

Specify radius for the corners of the rectangle. If this is > 0, then the drawable is drawn in a round-rectangle, rather than a rectangle.

Parameters
radius float: the radius for the corners of the rectangle

Protected methods

inflateTag

Added in API level 1
protected boolean inflateTag (String name, 
                Resources r, 
                XmlPullParser parser, 
                AttributeSet attrs)

Subclasses override this to parse custom subelements. If you handle it, return true, else return super.inflateTag(...).

Parameters
name String

r Resources

parser XmlPullParser

attrs AttributeSet

Returns
boolean