Hello,
How do I remove the BackgroundResource that I put in step 1 so I can SetColorFilter in step 3?
If you set SetBackgroundResource(0); //STEP 2
, Button
do not have any background. The value of Background property is NULL in step 3.
Remove this Resource.Drawable.borderGREEN_RED from the button so, it has the state as it was before I did set it
You can get the Background
Drawable before you execute step2. Then you can set it in Step 2 like following code.
Button button1 = FindViewById<Button>(Resource.Id.button10);
//get state as it was before you did set it
Android.Graphics.Drawables.Drawable btnDrawable = button1.Background;
button1.SetBackgroundResource(Resource.Drawable.borderGREEN_RED); //STEP 1
//STEP 2: set the state as it was before you did set it
button1.Background=btnDrawable; //STEP 2
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.