jlhonora/multistatetogglebutton

color confusion

Closed this issue · 3 comments

First up, I would like to congratulate you on making a great control. Thanks for putting this out there for re-use.

I am a bit confused on how to achieve the following: set a different button background AND text color for the 'pressed' and 'not pressed' buttons.

In the attached image, I would like to get the text color for the not-pressed to be one color, and the text color for the pressed to be different. Bot colors are unrelated to the button pressed and not pressed colors.

multi-select

I have only set the following in the colors.xml in my project:

    <color name="button_primary_color">#009FDF</color>
    <color name="button_secondary_color">#FFE0E0E0</color>

Also - is it possible to put a border on the control and/or button?

Thanks again, Paul.

Hi Paul, thanks for the kind words :)

For now, I guess the quickest way to achieve what you want is to just clone the repo and apply the styles directly. I'll leave this issue open so that I can take a look on how to support this natively.

Thanks for reporting this.

Thanks for the reply. I've had a look into the code, but I'm a bit of an Android newbie. Could you point me to where I would make the style changes for the text color (pressed and unpressed).

Paul.

For the text color, you can change it with color/button_primary_color and color/button_secondary_color. For v21 (lollipop and up) it uses the ?attr/primaryColor and ?attr/colorControlNormal.

For the border itself, you'll have to modify the shapes that reside in the drawable* folders.