我猜标题已经说出了我想做的事情:
我有一个ImageView,当要显示的图像从web (使用UIL)加载后,我想要
a.如果图像比ImageView大,请缩小图像以适合ImageView
b.不放大图像,而是在图像小于ImageView时以其原始大小显示
机器人没有任何问题
android:scaleType="fitCenter"对于a.和
android:scaleType="center"对于b。
有没有可能将两者结合起来?我唯一的选择是“手动”比较ImageView的大小和加载的BitMap的大小,并相应地设置scaleType吗?
编辑:这是我的UIL配置:
public static final DisplayImageOptions uiloptions = new DisplayImageOptions.Builder()
.resetViewBeforeLoading(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this)
.threadPoolSize(2)
.defaultDisplayImageOptions(Values.uiloptions).build();发布于 2017-01-10 15:20:20
尝试使用此属性:
android:scaleType="centerInside" Here is a link
https://stackoverflow.com/questions/30259227
复制相似问题