Android examples for Graphics:Drawable Operation
set Intrinsic Bounds from Drawable
//package com.java2s; import android.graphics.drawable.Drawable; import android.support.annotation.Nullable; public class Main { public static void setIntrinsicBounds(@Nullable Drawable drawable) { if (drawable == null) { return; }//from w w w.jav a 2 s . co m int height = drawable.getIntrinsicHeight(); int width = drawable.getIntrinsicWidth(); drawable.setBounds(0, 0, width, height); } }