如何反转(负)Android 矢量图像(路径)
How to Invert (Negative) Android Vector Image (Path)
需要Vector绑定的区域透明,背景(剩余区域)填充。当矢量(切换按钮可绘制)被选择器绑定时,需要使其易于动态填充颜色
我有从 Studio 生成的下面的矢量路径:(琥珀色 space 是透明的)
我想要这个:(琥珀色 space 是透明的)
感谢@pskink - 根据他的建议我使用了
myImageView.setColorFilter(Color.WHITE, PorterDuff.Mode.XOR);
myStateListDrawable.addState(new int[] { android.R.attr.state_checked }, myImageView);
实现我的需求。
向下滚动下方 link - 有易于理解的示例以及 ColorFilter 的其他选项
https://android--examples.blogspot.in/2015/11/android-color-filter-and-different.html
需要Vector绑定的区域透明,背景(剩余区域)填充。当矢量(切换按钮可绘制)被选择器绑定时,需要使其易于动态填充颜色
我有从 Studio 生成的下面的矢量路径:(琥珀色 space 是透明的)
我想要这个:(琥珀色 space 是透明的)
感谢@pskink - 根据他的建议我使用了
myImageView.setColorFilter(Color.WHITE, PorterDuff.Mode.XOR);
myStateListDrawable.addState(new int[] { android.R.attr.state_checked }, myImageView);
实现我的需求。
向下滚动下方 link - 有易于理解的示例以及 ColorFilter 的其他选项
https://android--examples.blogspot.in/2015/11/android-color-filter-and-different.html