[6.3.0][View点击态] 代码逻辑优化
This commit is contained in:
@@ -513,7 +513,7 @@ public class ViewPressedStateLancet {
|
||||
}
|
||||
int[][] states = new int[size][1];
|
||||
int[] colors = new int[size];
|
||||
states[0] = new int[] { android.R.attr.state_pressed };
|
||||
states[0] = new int[] { android.R.attr.state_pressed, -android.R.attr.state_focused };
|
||||
colors[0] = pressedColor;
|
||||
if (size > 2) {
|
||||
states[1] = new int[] { -android.R.attr.state_enabled };
|
||||
@@ -604,7 +604,7 @@ public class ViewPressedStateLancet {
|
||||
StateListDrawable result = new StateListDrawable();
|
||||
Drawable pressed = DrawableCompat.wrap(constantState.newDrawable().mutate());
|
||||
pressed.setAlpha((int)(255 * alpha));
|
||||
result.addState(new int[] { android.R.attr.state_pressed }, pressed);
|
||||
result.addState(new int[] { android.R.attr.state_pressed, -android.R.attr.state_focused }, pressed);
|
||||
result.addState(StateSet.WILD_CARD, old);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user