Android Guides | Samples

Android.Graphics.NinePatch Class

The NinePatch class permits drawing a bitmap in nine or more sections.

See Also: NinePatch

Syntax

[Android.Runtime.Register("android/graphics/NinePatch", DoNotGenerateAcw=true)]
public class NinePatch : Object

Remarks

The NinePatch class permits drawing a bitmap in nine or more sections. Essentially, it allows the creation of custom graphics that will scale the way that you define, when content added within the image exceeds the normal bounds of the graphic. For a thorough explanation of a NinePatch image, read the discussion in the 2D Graphics document.

The Draw 9-Patch tool offers an extremely handy way to create your NinePatch images, using a WYSIWYG graphics editor.

[Android Documentation]

Requirements

Namespace: Android.Graphics
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Graphics.NinePatch are listed below.

See Also: Object

Public Constructors

Create a drawable projection from a bitmap to nine patches.
Create a drawable projection from a bitmap to nine patches.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
BitmapBitmap. Returns the bitmap used to draw this NinePatch.
[read-only]
DensityInt32. Return the underlying bitmap's density, as per Bitmap.Density.
[read-only]
HasAlphaBoolean. Indicates whether this NinePatch contains transparent or translucent pixels.
[read-only]
HeightInt32. Returns the intrinsic height, in pixels, of this NinePatch.
[read-only]
NameString. Returns the name of this NinePatch object if one was specified when calling the constructor.
[read-only]
PaintPaint. Returns the paint used to draw this NinePatch.
[read-only]
WidthInt32. Returns the intrinsic width, in pixels, of this NinePatch.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Draw(Canvas, Rect)
Draws the NinePatch.
Draw(Canvas, RectF)
Draws the NinePatch.
Draw(Canvas, Rect, Paint)
Draws the NinePatch.
GetTransparentRegion(Rect) : Region
Returns a Region representing the parts of the NinePatch that are completely transparent.
static
IsNinePatchChunk(Byte[]) : Boolean
Verifies that the specified byte array is a valid 9-patch data chunk.
SetPaint(Paint)
Sets the paint to use when drawing the NinePatch.