i build an app with multi calculation system and it need every thing filled to get the result, so if the user left the checkbox
without selection i would to inform him by making the text and the box of the checkbox
change to "Red" like the picture in the link:
if we assume my checkbox is "Yes", so how to make code for this and another one to rerun it back to it's original one ?
I can make an custom xml file like this:
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@drawable/option_unselected" android:state_checked="false" android:color="#ff0000"/>
<item android:drawable="@drawable/option_selected" android:state_checked="true"/>
I know how to make the condition of checking:
if(yes.isChecked())
{check.setButtonDrawable(mContext.getResources().getDrawable(
R.drawable.custom_checkbox));}
else
{check.setButtonDrawable(mContext.getResources().getDrawable(
R.drawable.custom_checkbox));}
but in this case i need two somethings :
1- checkbox image like the default one on android, then making it's box "red"
2- i need a code to make it return back to default one with black text and box
,, So how i can do that ?!?! or if any one have another solution for my problem ??!
Aucun commentaire:
Enregistrer un commentaire