Password hint font is different than other edittext fields
Hey if someone is using kotlin I hope this code helps you, it is working for me. I'm using
com.google.android.material.textfield.TextInputLayout
and androidx.appcompat.widget.AppCompatEditText
in kotlin:
// find the view
val etPassword = view.findViewById<AppCompatEditText>(R.id.etPassword)
// set the typeface to your choice
etPassword.typeface = Typeface.SANS_SERIF
// the set its transformationMethod to PasswordTransformationMethod
etPassword.transformationMethod = PasswordTransformationMethod()
this is my xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tilPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
addding to this, It works when the iandroid:inputType=" textPassword" is removed and adding app:passwordToggleEnabled="true"
<android.support.design.widget.TextInputLayout
android:id="@+id/inpPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/button_margin_small"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/set_pass"
android:maxLength="@integer/pass_max"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
EditText password = (EditText) view.findViewById(R.id.etPassword);
password.setTypeface(Typeface.DEFAULT);
password.setTransformationMethod(new PasswordTransformationMethod());
Try this
<Edittext
android:id="@+id/edtPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:textSize="14sp" />
Set android:inputType="text"
in your edittext xml.
Set edtPassword.setTransformationMethod(new PasswordTransformationMethod());
in java file.
Works for me in custom font for edittext.