get intrinsic Bounds for a list of Drawable - Android Graphics

Android examples for Graphics:Drawable Operation

Description

get intrinsic Bounds for a list of Drawable

Demo Code


//package com.java2s;

import android.graphics.drawable.Drawable;

public class Main {
    public static void intrinsicBounds(Drawable... drawables) {

        if (drawables == null || drawables.length == 0) {
            return;
        }// www.ja  va2 s .  com

        for (Drawable drawable : drawables) {
            drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
                    drawable.getIntrinsicHeight());
        }
    }
}

Related Tutorials