在使用开源的gesture-imageview 来展示图片的时候,发现程序中对同一个imageview进行二次图片指定的时候,会失效。
找了半天找到解决方法如下:
修改gesture-imageview中 GestureImageView 类的initImage方法
protected void initImage() {
if(this.drawable != null) {
this.drawable.setAlpha(alpha);
this.drawable.setFilterBitmap(true);
if(colorFilter != null) {
this.drawable.setColorFilter(colorFilter);
}
// Keppel.Cao
layout = false;
startingScale = -1.0f;
}
if(!layout) {
//requestLayout();
//redraw();
requestLayout();
// Keppel.Cao
// redraw();
reset();
}
}原理还没时间看,记录下来给有需要的人,原文地址为
https://github.com/jasonpolites/gesture-imageview/issues/21
本文介绍了一个关于gesture-imageview在二次加载同一ImageView时出现的问题,并提供了解决方案。通过对GestureImageView类的initImage方法进行修改,可以使得在第二次加载图片时不再失效。

1125

被折叠的 条评论
为什么被折叠?



