共用方式為


NinePatch Class

Definition

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

[Android.Runtime.Register("android/graphics/NinePatch", DoNotGenerateAcw=true)]
public class NinePatch : Java.Lang.Object
[<Android.Runtime.Register("android/graphics/NinePatch", DoNotGenerateAcw=true)>]
type NinePatch = class
    inherit Object
Inheritance
NinePatch
Attributes

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.

Java documentation for android.graphics.NinePatch.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

NinePatch(Bitmap, Byte[], String)

Create a drawable projection from a bitmap to nine patches.

NinePatch(Bitmap, Byte[])

Create a drawable projection from a bitmap to nine patches.

NinePatch(IntPtr, JniHandleOwnership)

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

Properties

Bitmap

Returns the bitmap used to draw this NinePatch.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Density

Return the underlying bitmap's density, as per Bitmap#getDensity() Bitmap.getDensity().

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasAlpha

Indicates whether this NinePatch contains transparent or translucent pixels.

Height

Returns the intrinsic height, in pixels, of this NinePatch.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Name

Returns the name of this NinePatch object if one was specified when calling the constructor.

Paint

Returns the paint used to draw this NinePatch.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Width

Returns the intrinsic width, in pixels, of this NinePatch.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Draw(Canvas, Rect, Paint)

Draws the NinePatch.

Draw(Canvas, Rect)

Draws the NinePatch.

Draw(Canvas, RectF)

Draws the NinePatch.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetTransparentRegion(Rect)

Returns a Region representing the parts of the NinePatch that are completely transparent.

IsNinePatchChunk(Byte[])

Verifies that the specified byte array is a valid 9-patch data chunk.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPaint(Paint)

Sets the paint to use when drawing the NinePatch.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to