Example usage for android.graphics.drawable VectorDrawable getIntrinsicHeight

List of usage examples for android.graphics.drawable VectorDrawable getIntrinsicHeight

Introduction

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

Prototype

@Override
    public int getIntrinsicHeight() 

Source Link

Usage

From source file:com.github.topbottomsnackbar.TBSnackbar.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static Bitmap getBitmap(VectorDrawable vectorDrawable) {
    Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), vectorDrawable.getIntrinsicHeight(),
            Bitmap.Config.ARGB_8888);/*from w w w.  jav  a  2 s .  co  m*/
    Canvas canvas = new Canvas(bitmap);
    vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    vectorDrawable.draw(canvas);
    return bitmap;
}