android TextInputLayout changes EditText style after setting error to null

后端 未结 6 1742
独厮守ぢ
独厮守ぢ 2020-12-31 11:00

for the first time I\'m using the new Android\'s widget TextInputLayout, it\'s very nice but I\'m facing some problem using setError method

this is my xml



        
6条回答
  •  梦谈多话
    2020-12-31 11:20

    You just have to change the color back to whatever you want after setting the error to null. Something like:

    yourEditText.setError(null);
    yourEditText.getBackground().mutate().setColorFilter(
                ContextCompat.getColor(getContext() , R.color.somecolor),
                PorterDuff.Mode.SRC_ATOP);
    

提交回复
热议问题