如何更改所有州的背景色调?

问题描述 投票:0回答:1

我想知道如何改变所有州的背景色调。

int[][] states = new int[][] {
            new int[] {android.R.attr.state_empty, reminderColor.getMeasuredState()}};
    int[] colors = new int[] {color};
    ColorStateList myList = new ColorStateList(states, colors);
    reminderColor.setBackgroundTintList(myList);

实际上,使用此代码,我的ImageView就会消失。我不知道我做错了什么。

java android colors
1个回答
0
投票

事实上我找到了解决方案,我必须设置一个空状态的默认颜色,现在,它工作,我有这个代码:

int[][] states = new int[][] {
            new int[] {}};
    int[] colors = new int[] {color};
    ColorStateList myList = new ColorStateList(states, colors);
    reminderColor.setBackgroundTintList(myList);
© www.soinside.com 2019 - 2024. All rights reserved.