android - How do I create ColorStateList programmatically? -
I'm trying to create a But I'm not sure what the two criteria are. According to the document: Added to level 1 creates a color-state list that returns to states with special mapping colors. How can someone explain this to me? What does the two-dimensional array mean for states? Look for a list of available states. If you want to set colors for disabled, unfollowed, unchecked states etc. Reject states: ColorStateList using it:
color space list state list = new colorStateList (states, colors);
public colorStateList ant [] [] states, enter [] color)
int [] [] states = new int [] [] {new int [] {android.R.attr.state_enabled}, // enable new int [] { -android.R.attr.state_enabled}, // Disabled new entry [] {-android.R.attr.state_checked}, // unchecked new int [] {android.R.attr.state_pressed} // Suppressed}; Int [] Color = New Int [] {Color. Black, color RD, color. Green, Color. BLUE}; ColorStateList myList = new ColorStateList (state, color);
Comments
Post a Comment