I cant figure out how to get the current color of the text of a Button. I know its probably this but cant quite figure out the parameters.
public static int getTextColor (Context context, TypedArray attrs, int def)...
Basically Im trying to do this
if(text is RED)
{make text BLACK}
else
{make text RED}
I know how to set the text color.
try this
ColorStateList mList = mButton.getTextColors();
int color = mList.getDefaultColor();
switch(color)
{
case Color.RED:
mButton.setTextColor(Color.BLACK);
break;
case Color.BLACK:
mButton.setTextColor(Color.RED);
break;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With