Tag: checkedtextview状态

如何用十六进制值更改CheckedTextView的Checked Tint Color

我想在checked视图的状态时动态地改变CheckedTextView的色调。 我很确定我可以通过在CheckedTextView上调用setCheckMarkTintList来实现这CheckedTextView 。 要做到这一点,我需要一个ColorStateList ,但问题是我想保留CheckedTextView每个状态的所有颜色,除了checked状态。 所以,我可以获得ColorStateList的CheckedTextView ,但是我不知道只能更改checked状态的颜色。 我知道我可以创建一个新的ColorStateList ,但是如何确保它保留了原始的所有值? 我可以像这样创建一个状态列表: int[][] states = new int[][] { new int[]{android.R.attr.state_pressed}, new int[]{-android.R.attr.state_pressed}, new int[]{android.R.attr.state_focused}, new int[]{-android.R.attr.state_focused}, new int[]{android.R.attr.state_selected}, new int[]{-android.R.attr.state_selected}, new int[]{android.R.attr.state_checkable}, new int[]{-android.R.attr.state_checkable}, new int[]{android.R.attr.state_checked}, new int[]{-android.R.attr.state_checked}, new int[]{android.R.attr.state_enabled}, new int[]{-android.R.attr.state_enabled}, new int[]{android.R.attr.state_window_focused}, new int[]{-android.R.attr.state_window_focused}, new int[]{} // default state } 并从原始ColorStateList的颜色创建一个颜色列表: int[] colors = new […]