TextInputLayout and EditText double hint issue

后端 未结 7 2285
生来不讨喜
生来不讨喜 2021-02-11 19:34

I want to set the hint with java in EditText(which is in TextInputLayout).

Code used for setting hint:

aET = (EditText) findViewById(R.id.

7条回答
  •  广开言路
    2021-02-11 19:59

    I found the solution !

    In your EditText add

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

    And in the code set the hint from the EditText

    aET.setHint("h?");
    

    The hint in your editText is hidden and the hint from the TextInputLayout is shown.

    EDIT :

    Other solution (The best)

    Update Graddle with the new version of android:design

    compile 'com.android.support:design:22.2.1'
    

提交回复
热议问题