[Android]Bitmap, Drawable之间的変換

Resource → Bitmap

BitmapFactory.decodeResource(getResources(), R.drawable.icon)

Resource → Drawable

getResources().getDrawable(R.drawable.icon)

Drawable → Bitmap

((BitmapDrawable) drawable).getBitmap()

Bitmap → Drawable

newBitmapDrawable(getResources,bitmap)

你可能感兴趣的:([Android]Bitmap, Drawable之间的変換)