Change Nine Patch image color at runtime android

泪湿孤枕 提交于 2019-12-11 07:59:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!