android - How do I create ColorStateList programmatically? -


I'm trying to create a ColorStateList using it:

  color space list state list = new colorStateList (states, colors);   

But I'm not sure what the two criteria are.

According to the document:

  public colorStateList ant [] [] states, enter [] color)   

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:

  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

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -