Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setButtonClickable #6

Open
Theoneee opened this issue Jul 24, 2019 · 4 comments
Open

setButtonClickable #6

Theoneee opened this issue Jul 24, 2019 · 4 comments

Comments

@Theoneee
Copy link

        <top.androidman.SuperButton
            android:id="@+id/btn_action_right"
            style="@style/custom_bottom_action_style"
            app:color_normal="?config_color"
            app:color_pressed="@color/press_color"
            app:textColor="@color/qmui_config_color_white"
            app:textSize="?sp_16" />
      mSubmit.setUnableColor(getColorr(R.color.press_color));
      mSubmit.setButtonClickable(false);

可是当mSubmit.setButtonClickable(true);时,颜色不会变成color_normal

@Theoneee
Copy link
Author

将setUnableColor设为color_pressed比较好。

@ansnail
Copy link
Owner

ansnail commented Jul 24, 2019

新版本将会加入如下方法,希望可以简化你的操作,请继续关注哦
/**
     * 设置按钮颜色以及是否可以点击
     * 不影响color_pressed的值
     *
     * @param color           设置按钮的color_normal值
     * @param buttonClickable 设置按钮是否可点击
     */
    public void setButtonClickable(@ColorInt int color, boolean buttonClickable) 

@Theoneee
Copy link
Author

建议在declare-styleable里再加两个属性:

enabled_true_color     enabled_false_color   

默认就是普通颜色和按压的颜色。
不然我写一个布局,每次在用到的时候都要去写会很麻烦。全局的必须要有,动态设置视情况。能全局的绝对不要搞动态。

@Theoneee
Copy link
Author

@ansnail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants