-1
A
回答
0
ImageRequest imgRequest = new ImageRequest(url, new Response.Listener<Bitmap>() {
@Override
public void onResponse(Bitmap _bitmapScaled) {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
_bitmapScaled.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
//you can create a new file name "test.jpg" in sdcard folder.
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "test.jpg")
f.createNewFile();
//write the bytes in file
FileOutputStream fo = new FileOutputStream(f);
fo.write(bytes.toByteArray());
// remember close de FileOutput
fo.close();
}
}, 0, 0, ImageView.ScaleType.CENTER_CROP, Bitmap.Config.ARGB_8888,
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//do stuff
}
});
+0
谢谢!很多!我会尝试一下。 –
+0
当然..如果这能帮助你,请批准答案。 –
+0
我在其他帖子上找到了答案(最后):) http://stackoverflow.com/a/24650151/5487135 –
相关问题
- 1. 将图像设置为壁纸
- 2. 如何以编程方式将图像设置为壁纸?
- 3. 如何将图像设置为来自ImageView的壁纸?
- 4. 可以将本地图像设置为iphone中的壁纸吗?
- 5. Android - 如何设置壁纸图像
- 6. Android - 如何设置壁纸图像?
- 7. Android设置图像作为壁纸
- 8. android设置图像我作为壁纸
- 9. 将XML文件设置为壁纸?
- 10. Android - 在imageview中将当前图像设置为系统壁纸
- 11. 将图像设置为来自url的壁纸
- 12. 在IPad上设置壁纸
- 13. 位图到壁纸调整大小缩放设置壁纸
- 14. 从本地设备的路径,获取图像设置为壁纸
- 15. Android设置壁纸
- 16. Nativescript android如何将远程图像下载到设备?
- 17. 代码设置任何图像作为壁纸从画廊
- 18. 如何将Android标题图标设置为下载图像
- 19. 如何从毕加索图书馆下载图片并将其设置为壁纸
- 20. 在Droid X上裁剪图片将生成的图片设置为壁纸
- 21. 可以设置壁纸本身的动态壁纸?
- 22. 如何切换两个壁纸(LiveWallpapaer设备和单个图像作为壁纸myApp)
- 23. 如何显示对话框以将图像设置为android中的壁纸或个人资料图片?
- 24. 从SD卡上的图像设置壁纸
- 25. 设置壁纸使用ACTION_SET_WALLPAPER
- 26. 用URI设置壁纸
- 27. 在Android中设置壁纸
- 28. 设置壁纸的问题
- 29. 设置主屏幕壁纸
- 30. 从webview设置壁纸URL
我不明白为什么这个问题被低估。 –
@FaisalShaikh哦,我应该尝试再解释一下吗? –