【基础篇】Android中获取Drawable的方法
public static Drawable getDrawable(Context context,String filename)
{
BitmapDrawable drawable=null;
InputStream is;
try {
is = context.getAssets().open(ConstantValue.ASSETS_RES_PATH+filename);
Bitmap bitmap = BitmapFactory.decodeStream(is);
drawable = new BitmapDrawable(context.getResources(), bitmap);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
return drawable;
}