setHintTextColor() in EditText setHintTextColor() in EditText android android

setHintTextColor() in EditText


Simply add this in your layout for the EditText :

android:textColorHint="#FFFFFF"


Use this to change the hint color. -

editText.setHintTextColor(getResources().getColor(R.color.white));

Solution for your problem -

editText.addTextChangedListener(new TextWatcher() {    @Override    public void onTextChanged(CharSequence arg0, int arg1, int arg2,int arg3){        //do something    }    @Override    public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {        //do something    }    @Override    public void afterTextChanged(Editable arg0) {        if(arg0.toString().length() <= 0) //check if length is equal to zero            tv.setHintTextColor(getResources().getColor(R.color.white));    }});


Default Colors:

android:textColorHint="@android:color/holo_blue_dark"

For Color code:

android:textColorHint="#33b5e5"