2017-10-21 37 views
0

我將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,我添加了截圖和代碼片段。請看一下。謝謝 –

回答

0

這是關於焦點重新打開應用程序後,紅色。您可以在onResume上請求關注您的editText。

+0

不行,對不起 –