create Scalable Drawable - Android android.graphics.drawable

Android examples for android.graphics.drawable:Drawable

Description

create Scalable Drawable

Demo Code

import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.drawable.NinePatchDrawable;

public class Main {

  public static NinePatchDrawable createScalableDrawable(Bitmap pic) {
    NinePatch np = new NinePatch(pic, pic.getNinePatchChunk(), null);
    return new NinePatchDrawable(np);
  }//from   w w  w . ja  va2  s  .  c  om

}

Related Tutorials