我想在视图上同步显示图像,并且我正在使用通用图像加载器:https://github.com/nostra13/Android-Universal-Image-Loader在异步调用时,库会正确显示图像。虽然,做这样的事情:myImageView.setBackground(new BitmapDrawable(getApplicationContext().getResources(), ImageLoader.getInstance().loadImageSync("path/to/image")));图像被显示,忽略布局上的 scaleType,即 centerCrop。我想这样做而不必处理会增加加载时间的图像。我已经在谷歌上搜索了 4 个小时没有运气。我在这里找到了一些线程,但它们没有帮助。感谢您的时间。
1 回答
喵喵时光机
TA贡献1846条经验 获得超7个赞
你应该使用setImageDrawable()
而不是setBackground()
. 使用图像作为背景将始终忽略比例类型。
myImageView.setImageDrawable(new BitmapDrawable(getApplicationContext().getResources(), ImageLoader.getInstance().loadImageSync("path/to/image")));
添加回答
举报
0/150
提交
取消