package com.androapplite.antivitus.antivitusapplication.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.view.ViewGroup;
import java.io.InputStream;
import static com.androapplite.antivitus.antivitusapplication.common.AntiVirusApplication.context;
/**
* @author wj
* @date 2018/1/29
*/
public class LoadBitmapOomUtils {
public static void setBackGroundDrawable(ViewGroup viewGroup, int resId) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
InputStream is = context.getResources().openRawResource(resId);
Bitmap bm = BitmapFactory.decodeStream(is, null, opt);
BitmapDrawable bd = new BitmapDrawable(context.getResources(), bm);
viewGroup.setBackgroundDrawable(bd);
}
}
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net