![](/img/trans.png)
[英]How does scaleType and wrap_content determine ImageView width and height?
[英]BitmapDrawable does not respect scaleType on view
我想在視圖上同步顯示圖像,並且正在使用Universal Image Loader:
https://github.com/nostra13/Android-Universal-Image-Loader
在異步調用中,庫將正確顯示圖像。 雖然,做這樣的事情:
myImageView.setBackground(new BitmapDrawable(getApplicationContext().getResources(), ImageLoader.getInstance().loadImageSync("path/to/image")));
圖像被顯示,而忽略了我在scaleCrop布局上的scaleType。 我想這樣做而不必處理圖像,這會增加加載時間。 我已經搜索Google四個小時了,沒有運氣。 我在這里找到了一些線程,但是它們沒有幫助。
感謝您的時間。
您應該使用setImageDrawable()
而不是setBackground()
。 將圖像用作背景將始終忽略比例類型。
myImageView.setImageDrawable(new BitmapDrawable(getApplicationContext().getResources(), ImageLoader.getInstance().loadImageSync("path/to/image")));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.