Tag: rippledrawable

如何更改可绘制波纹的纯色?

这里是我的波纹drawable,我想改变state_selected , 纯色 。 我试过的代码: RippleDrawable rippleDrawable = (RippleDrawable) textView.getBackground(); // assumes bg is a RippleDrawable int[][] states = new int[][]{new int[]{android.R.attr.state_selected}}; int[] colors = new int[]{R.color.white}; ColorStateList colorStateList = new ColorStateList(states, colors); rippleDrawable.setColor(colorStateList); 不幸的是它不工作..我错过了什么,这可能吗?