DrawableUtils.java 文件源码

java
阅读 40 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
private static StateListDrawable getStateListDrawable(@ColorInt int normalColor,
                                                      @ColorInt int pressedColor) {
    StateListDrawable states = new StateListDrawable();
    states.addState(new int[]{android.R.attr.state_activated}, getColorDrawable(pressedColor));
    states.addState(new int[]{}, getColorDrawable(normalColor));
    // Animating across states.
    // It seems item background is lost on scrolling out of the screen, 21 <= API <= 23
    if (!Utils.hasLollipop() || Utils.hasNougat()) {
        int duration = 200; //android.R.integer.config_shortAnimTime
        states.setEnterFadeDuration(duration);
        states.setExitFadeDuration(duration);
    }
    return states;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号