android ColorStateList

在java里

    public ColorStateList getSecondPro() {
//        int[] colors = new int[] { pressed, focused, normal, focused, unable, normal };
        int[] colors = new int[] { android.R.color.background_dark, android.R.color.background_dark
                , android.R.color.background_dark, android.R.color.background_dark, android.R.color.background_dark
                , android.R.color.background_dark };
        int[][] states = new int[6][];
        states[0] = new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled };
        states[1] = new int[] { android.R.attr.state_enabled, android.R.attr.state_focused };
        states[2] = new int[] { android.R.attr.state_enabled };
        states[3] = new int[] { android.R.attr.state_focused };
        states[4] = new int[] { android.R.attr.state_window_focused };
        states[5] = new int[] {};
        ColorStateList colorStateList = new ColorStateList(states,colors);
        return colorStateList;
    }

在xml中

  
  
       
       
       
  

全部属性

  
     
         
     

你可能感兴趣的:(android ColorStateList)