mTextViewBack.setTextColor(createColorStateList( 0xffffffff , 0xffffff00 , 0xff0000ff , 0xffff0000 )); |
private ColorStateList createColorStateList( int normal, int pressed, int focused, int unable) { |
int [] colors = new int [] { pressed, focused, normal, focused, unable, normal }; |
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 colorList = new ColorStateList(states, colors); |
return colorList; |
} |
by: 发表于:2018-01-02 10:00:30 顶(1) | 踩(1) 回复
??
回复评论