This commit is contained in:
sloop
2016-02-03 00:58:54 +08:00
parent 82b35f92c6
commit 50a5f0a104

View File

@@ -236,6 +236,13 @@ public void drawPicture (Picture picture, RectF dst)
**PS关于Drawable相关内容以后会专门进行讲解此处仅仅提及一下。**
通过BitmapDrawable获取Bitmap(如果仅仅为了获取Bitmap不推荐该方法建议使用BitmapFactory):
文件来源 | 获取代码
--- | ---
drawable | BitmapDrawable drawable = (BitmapDrawable) mContext.getResources().getDrawable(R.drawable.bitmap);<br/>Bitmap bitmap = drawable.getBitmap();
mipmap | BitmapDrawable drawable = (BitmapDrawable) mContext.getResources().getDrawable(R.mipmap.bitmap);<br/>Bitmap bitmap = drawable.getBitmap();
raw | InputStream is = mContext.getResources().openRawResource(R.raw.bitmap);<br/>BitmapDrawable drawable = new BitmapDrawable(is);<br/>Bitmap bitmap = drawable.getBitmap();