Example usage for android.graphics.drawable NinePatchDrawable NinePatchDrawable

List of usage examples for android.graphics.drawable NinePatchDrawable NinePatchDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable NinePatchDrawable NinePatchDrawable.

Prototype

private NinePatchDrawable(@NonNull NinePatchState state, @Nullable Resources res) 

Source Link

Document

The one constructor to rule them all.

Usage

From source file:Main.java

/** return NinePatchDrawable with give id
 * @param aContext//from  w w  w. j av a 2  s  . c  om
 * @param aNinePatchResourceId
 * @return
 */
public static NinePatchDrawable getNinePatchDrawable(Context aContext, int aNinePatchResourceId) {
    Bitmap bg = BitmapFactory.decodeResource(aContext.getResources(), aNinePatchResourceId);
    NinePatch np = new NinePatch(bg, bg.getNinePatchChunk(), null);
    NinePatchDrawable t9Patch = new NinePatchDrawable(aContext.getResources(), np);
    return t9Patch;
}