Skip to content

Most visited

Recently visited

navigation

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

From class android.graphics.drawable.ShapeDrawable

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

From class android.graphics.drawable.ShapeDrawable
From class android.graphics.drawable.Drawable
From class java.lang.Object

Public constructors

PaintDrawable

added in API level 1
PaintDrawable ()

PaintDrawable

added in API level 1
PaintDrawable (int color)

Parameters
color int

Public methods

setCornerRadii

added in API level 1
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
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
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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)