Removing the background color of an EditText

前端 未结 3 1799
一个人的身影
一个人的身影 2020-12-19 17:41

I have an editText and i want to set its background color to red like this:

 RegistrationCountry.setBackgroundColor(Color.RED);

Now i yould

3条回答
  •  误落风尘
    2020-12-19 18:15

    If you just want to highlight the EditText object, you can use PorterDuff instead: http://developer.android.com/reference/android/graphics/PorterDuff.Mode.html.

    To set the color:

    RegistrationCountry.getBackground().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
    

    To remove the color:

    RegistrationCountry.getBackground().clearColorFilter();
    

提交回复
热议问题