Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android : TextInputLayout hides drawableRight of child EditText

I am always updated with library updates, and this is what it resulted into.

In build.gradle(Project:xxx):

classpath 'com.android.tools.build:gradle:2.2.0-beta1'

In build.gradle(Module:app)

compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'

And put password field as below:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.AppCompatEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

Taadaa...My Password field looks now as below:

enter image description here

You can also go simply with EditText.

But, there are some glitches in this update.

Problem: If I put any drawableRight in EditText, it displays nothing. TextInputLayout also has property to disable toggle functionality. I did it that too as below, but no success:

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:passwordToggleEnabled="false">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:drawableRight="@drawable/ic_alarm_on_black_24dp"
        android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

Can anyone help me please.

like image 351
Chintan Soni Avatar asked Aug 26 '16 10:08

Chintan Soni


1 Answers

I reported the issue at https://code.google.com/p/android/issues/detail?id=221002.

It was a bug in the library version 24.2.0 but it has been fixed in version 24.2.1. Simply update as below:

compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
like image 183
Chintan Soni Avatar answered Oct 16 '22 17:10

Chintan Soni