错误Error “You must not call setTag() on a view Glide is targeting” when use Glide

参考自:http://blog.csdn.net/ltym2014/article/details/51558695

项目中在使用Glide图片加载框架是遇到如下错误

You must not call setTag() on a view Glide is targeting

报错原因大致是因为Glide加载的iamgeView调用了setTag()方法导致的错误,
因为Glide已经默认为ImageView设置的Tag。

解决办法:自定义一个Application,在里面加上

public class App extends Application {
    @Override public void onCreate() {
        super.onCreate();
        ViewTarget.setTagId(R.id.glide_tag);
    }
}

然后在/values/ids.xml加上

<resources>  
    <item type="id" name="glide_tag" />  
</resources>  

猜你喜欢

转载自blog.csdn.net/c_j33/article/details/78975764