0

메인 테마에서 속성을 추가하는 것처럼이 solution을 시도했지만 기본적으로 TextInputLayout에서 하단 라인의 색상을 변경할 수 없습니다. 상태 표시 줄의 색상 (기본 색상은 아마도 기본 색상) 또한 오류 텍스트가 아래에 나타날 때 최종 줄 색상을 변경하고 싶지 않습니다. TextInputLayout은 오류가 발생했을 때 빨간색을 변경하는 대신 초점이 맞을 때 해당 색상이어야 함을 의미합니다.TextInputLayout에서 하단 라인의 색상을 변경하는 방법

+0

당신은 'android : backgr oundTint = "@ color/red (당신의 색)"??? –

+0

시도해주세요. [이] (https://stackoverflow.com/questions/45408295/change-textinputlayout-focused-unfocused-hint-color-programmatically/45409379#45409379) – KeLiuyue

+0

나는 그것이 단지 최종선의 색을 바꿀 것이라고 생각하지만, 초점이 맞았을 때 또는 오류가 발생할 때 – blackHawk

답변

0

오류가 발생하고 재설정하려고 할 때 귀하의 editText 및 귀하의 하단 라인 색상, 그럼 그냥 아래 코드를 사용

textInputLayout.setError(null); 
       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 
        textEditText.getBackground().setColorFilter(getResources().getColor(R.color.your_color,getTheme()), PorterDuff.Mode.SRC_ATOP); 
       }else { 
        //noinspection deprecation 
        textEditText.getBackground().setColorFilter(getResources().getColor(R.color.your_color), PorterDuff.Mode.SRC_ATOP); 
       } 
+0

초점이 맞지 않을 때 최종 색을 바꾼다. – blackHawk