我在我的应用程序中使用毕加索,并且设法在用户点击时在全屏视图中打开图像。现在我想要一个覆盖图像并将图像设置为壁纸的按钮。 所有图像都从URL加载并存储在远程服务器中。将设置图像从URL加载为壁纸
我不知道如何实现这一点,因为我是一个veely初学者。有人能帮我吗?
谢谢。
我在我的应用程序中使用毕加索,并且设法在用户点击时在全屏视图中打开图像。现在我想要一个覆盖图像并将图像设置为壁纸的按钮。 所有图像都从URL加载并存储在远程服务器中。将设置图像从URL加载为壁纸
我不知道如何实现这一点,因为我是一个veely初学者。有人能帮我吗?
谢谢。
使用ImageLoader代替:
DisplayImageOptions options = new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.ALPHA_8)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
ISolaceContext.getAppContext())
.discCacheExtraOptions(20, 20, CompressFormat.JPEG, 100, null)
.defaultDisplayImageOptions(Media.options).build();
ImageLoader.getInstance().init(config);
ImageLoader loader = ImageLoader.getInstance();
loader.loadImage(url, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
// Now you have the image in your hands as a Bitmap(called: loadedImage) and Now you can do whatever you want with it
stream.close();
stream = null;
}
});
loader.clearDiscCache();
loader.clearMemoryCache();
现在你可以使用先前生成位图作为背景。 converting bitmap to drawable。
非常感谢!那么你是否建议我应该使用UIL而不是毕加索? –
@FedericoMoretto是的,我认为你应该使用它,因为它使你能够处理结果位图(因为它会被加载到你的应用程序中)而不能直接分配它,而不能以不同的方式处理它 –
@JakeWharton这不是我的工作,你不明白它 –
我简化了我的答案代码,以防万一你在第一时间发现它更复杂 –