RoundButton.java 文件源码

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

项目:RoundButton 作者:
private void update() {
    StateListDrawable background = new StateListDrawable();
    background.addState(new int[]{android.R.attr.state_pressed}, createDrawable(backgroundColorPressed, cornerColorPressed, cornerWidth, cornerRadius));
    background.addState(new int[]{-android.R.attr.state_enabled}, createDrawable(backgroundColorDisabled, cornerColorDisabled, cornerWidth, cornerRadius));
    background.addState(StateSet.WILD_CARD, createDrawable(backgroundColor, cornerColor, cornerWidth, cornerRadius));
    setBackground(background);

    setTextColor(new ColorStateList(
            new int[][]{
                    new int[]{android.R.attr.state_pressed},
                    new int[]{-android.R.attr.state_enabled},
                    new int[]{}
            },
            new int[]{
                    textColorPressed,
                    textColorDisabled,
                    textColor
            }
    ));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号