Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

My drawableLeft disappear if I use passwordToggleEnabled (EditText)

$
0
0

I'm trying to have beautiful EditText in my application and I would use DrawableLeft to add simple icon on each input.Everything is ok but on the EditText "Password", I added the passwordToggleEnabled (The user can see the input if he clicks on the eye).Adding this makes my drawableLeft disappear.

Have you and idea ? (Sorry for my poor english :-/)

Capture with drawable left

Capture with password eye

Here is my TextInputLayout :

<android.support.design.widget.TextInputLayout    android:id="@+id/textInputPassword"    android:layout_width="300dp"    android:layout_height="60dp"    android:layout_marginTop="16dp"    android:theme="@style/EditTextHint"    app:layout_constraintEnd_toEndOf="parent"    app:layout_constraintStart_toStartOf="parent"    app:layout_constraintTop_toBottomOf="@+id/textInputEmail"><EditText        android:id="@+id/editTextPassword"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginBottom="8dp"        android:layout_marginTop="8dp"        android:backgroundTint="@color/shapy_blue"        android:drawablePadding="10dp"        android:drawableStart="@mipmap/picto_password_blue"        android:ems="10"        android:hint="@string/enter_password"        android:inputType="textPassword"        android:textColor="@color/shapy_blue"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintHorizontal_bias="0.478"        app:layout_constraintLeft_toLeftOf="parent"        app:layout_constraintRight_toRightOf="parent"        app:layout_constraintTop_toTopOf="parent"        app:layout_constraintVertical_bias="0.459" /></android.support.design.widget.TextInputLayout>

Edit >> When I change the drawable color in Java, (on Focus listener)

@Overridepublic void onFocusChange(View view, boolean b) {    if(view == editTextEmail){        editTextEmail.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.picto_mail_white,0,0,0);        editTextEmail.setTextColor(getResources().getColor(R.color.white));    } else {        editTextEmail.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.picto_mail_blue,0,0,0);        editTextEmail.setTextColor(getResources().getColor(R.color.shapy_blue));    }    if(view == editTextPasswordLogin){        editTextPasswordLogin.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.picto_password_white,0,0,0);        editTextPasswordLogin.setTextColor(getResources().getColor(R.color.white));    } else {        editTextPasswordLogin.setCompoundDrawablesWithIntrinsicBounds(R.mipmap.picto_password_blue,0,0,0);        editTextPasswordLogin.setTextColor(getResources().getColor(R.color.shapy_blue));    }}

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>