问题
Good day.I want to change the actual 9 patch png image color during the runtime.The reason i need,is that i want to let user customize the actual color of image.My 9 patch image is an chat bubble.Simple DrawableTintCompat is not working as it is tinting the whole background except actual bubble.What i want is something like tinting,where the color of that bubble will be changed in 9 patch,so any of you guys have encounter such thing?Can you please give me an heads up?
回答1:
Ok i have managed to do it slightly in other way.Here what you can do.
ninePatchImageViewHolder.setColorFilter(Color.parseColor(s), PorterDuff.Mode.SRC_ATOP);
At this point it will not change the whole background and keep the bubble lets say in same color,but will in correct way change the actual bubble color
来源:https://stackoverflow.com/questions/39243205/change-nine-patch-image-color-at-runtime-android