应用程序转到后台后EditText背景颜色不正确

问题描述:

我将EditText的背景颜色从蓝色更改为红色。当我将我的应用程序放在后台(按菜单按钮)并从打开的应用程序菜单重新打开时,颜色将更改为默认颜色。应用程序转到后台后EditText背景颜色不正确

我试图强制在onResume()中将其更改为红色,但它不起作用。

我的EditText是TextInputLayout

任何线索,社区里面?提前致谢!

这是它的外观以正常的方式后,我初始化错误上的EditText enter image description here

之后,我隐藏了应用,然后将推出应用程序 enter image description here

它重新打开它就像那样 enter image description here

错误初始化代码

private void initPasswordError() { 
inputPassword.getBackground() 
    .setColorFilter(ContextCompat 
      .getColor(getApplicationContext(), com.example.easyplanet.R.color.watermelon), 
     PorterDuff.Mode.SRC_ATOP); 
clearPasswordField.setImageResource(com.example.easyplanet.R.drawable.ic_clear_red); 
setInputTextLayoutColor(passwordTextInputLayout, ContextCompat.getColor(this, R.color.watermelon)); 

}

我需要的EditText背景仍然从背景

+2

请张贴屏幕截图和您的代码与所需的输出 –

+0

@AshishRanjan,我添加了截图和代码片段。请看一下。谢谢 –

这是关于焦点重新打开应用程序后,红色。您可以在onResume上请求关注您的editText。

+0

不行,对不起 –