在使用开源的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