get Text Drawable - Android Graphics

Android examples for Graphics:Drawable

Description

get Text Drawable

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;
    }/*  ww w  .j  a va2s . co  m*/
}

Related Tutorials