png jpg 图片文件转Drawable

private void setDrawable(String filePath) {
	Bitmap bitmap=BitmapFactory.decodeFile(filePath);
	Drawable drawable = new BitmapDrawable(getResources(), bitmap);
	((ImageView) findViewById(R.id.img)).setImageDrawable(drawable);
}

猜你喜欢

转载自blog.csdn.net/yongwoozzang/article/details/80195529