get Text Drawable by resource id - Android Graphics

Android examples for Graphics:Drawable Read

Description

get Text Drawable by resource id

Demo Code


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

import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable getTextDrawable(Context context, int resId) {
        Drawable drawable = context.getResources().getDrawable(resId);
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
                drawable.getIntrinsicHeight());
        return drawable;
    }//from  www .ja  v a 2 s.  c o  m
}

Related Tutorials