Issue
I am trying to set a ColorStateList of my EditText programmatically
ColorStateList textColorStateList = new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_enabled},
new int[]{-android.R.attr.state_enabled},
new int[]{},
},
new int[]{
R.color.DARK_GRAY_COLOR,
R.color.LIGHT_RED_COLOR,
R.color.DARK_GRAY_COLOR});
Here is how I use it on my EditText
editText.setTextColor(textColorStateList);
But whenever I set the editText.setEnabled(false); The color of my editText stays the same.
Any ideas?
Solution
the second parameter is the list of colors not of the id of resources. Use it like
new int[]{
getColor(R.color.DARK_GRAY_COLOR),
getColor(R.color.LIGHT_RED_COLOR),
getColor(R.color.DARK_GRAY_COLOR) }
Answered By - Blackbelt
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.