String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "ww.jpg";
public Drawable stringToDrawable(String path){
FileInputStream input = null;
try {
input = new FileInputStream(new File(path));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
//先转换成bitmap
Bitmap bmp = BitmapFactory.decodeStream(input);
//再转换成drawable
@SuppressWarnings("deprecation")
Drawable drawable = new BitmapDrawable(bmp);
return drawable;
}
最后
以上就是高贵板凳最近收集整理的关于android 将sdcard中的图片转换成Bitmap 和Drawable的全部内容,更多相关android内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复