set Drawable Bounds - Android Graphics

Android examples for Graphics:Drawable Operation

Description

set Drawable Bounds

Demo Code


//package com.java2s;
import android.content.Context;

import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable setBounds(Drawable drawable) {
        drawable.setBounds(0, 0, drawable.getMinimumWidth(),
                drawable.getMinimumHeight());
        return drawable;
    }/* w  w w  . j  a v a2  s.  co m*/

    public static Drawable setBounds(Context context, int drawableId) {
        Drawable drawable = context.getResources().getDrawable(drawableId);
        return setBounds(drawable);
    }
}

Related Tutorials