我正在构建一个Android Things“信息亭”风格的应用程序,我希望图像像壁纸一样显示在背景中。我使用Unsplash源来获取随机图像,但源URL(https://source.unsplash.com/1080x1920/?long-exposure)总是重定向到图像URL,所以我不能使用这个:InputStream is = (InputStream) new URL("https://source.unsplash.com/1080x1920/?long-exposure").getContent();Drawable d = Drawable.createFromStream(is, "");niceWallpaper.setImageDrawable(d);有没有办法做到这一点?
2 回答

浮云间
TA贡献1829条经验 获得超4个赞
使用可以解决您的问题。Picasso
String yourUrl = "https://source.unsplash.com/1080x1920/?long-exposure"; Picasso.with(MyApplication.getAppContext()).load(yourUrl).placeholder(defaultImage).memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE).into(YourImageView);
添加回答
举报
0/150
提交
取消