记录下遇到的问题:
程序中通过getDrawable加载统一资源,这个资源会在很多页面或者一个页面的不同地方使用,而当修改某一个地方的drawable的颜色等属性时,其他地方的该资源也同时变化了。
public void changeDrawableColor (int color) { Drawable bgDrawable = context.getResources().getDrawable(R.mipmap.icon_loading_bg); Drawable centerDrawble = context.getResources().getDrawable(R.mipmap.icon_loading_center); if (bgDrawable != null && centerDrawble != null) { bgDrawable.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); centerDrawble.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); mBackgroud.setImageDrawable(bgDrawable); mCenter.setImageDrawable(centerDrawble); } }drawable缓存分析: https://blog.youkuaiyun.com/hello__zero/article/details/43230149