Home > Enterprise >  How to make text grey in TextInputEditText after TextInputLayout enabled = false?
How to make text grey in TextInputEditText after TextInputLayout enabled = false?

Time:11-08

When I disable my TextInputLayout

InputTextContainer.isEnabled = false

it's getting grey so visually you understand that it's unavailable but text in it still black even it's blocked too. I want my text to be grey as the disabled container. Can you help me to do that?

CodePudding user response:

Suppose this is your xml view

<com.google.android.material.textfield.TextInputLayout
        android:id="@ id/pswrd"
        .....>

        <com.google.android.material.textfield.TextInputEditText
            android:id="@ id/pswrd_text"
            ....>

        </com.google.android.material.textfield.TextInputEditText>

    </com.google.android.material.textfield.TextInputLayout>

you can try 2 things:

  1. along with setting pswrd.isEnabled = false, set pswrdText.isEnabled=false as well.
  2. in case 1 doesnt work, try pswrdText.setTextColor(android.R.color.darker_gray)

CodePudding user response:

Try this method just as @Nitin Verma answered.

<com.google.android.material.textfield.TextInputEditText
    android:id="@ id/edt_email">

<TextView
  android:id="@ id/textView20"
  android:layout_width="wrap_content"/>

<com.google.android.material.textfield.TextInputEditText/>

edt_email.isEnable = false
textView20.isEnable = false
  • Related