EditText password = (EditText) view.findViewById(R.id.etPassword);
if (Build.VERSION.SDK_INT != android.os.Build.VERSION_CODES.KITKAT) {
Typeface typeface = TypefaceUtil.overrideFont(getContext(), "SERIF", "fonts/calibri.ttf");
password.setTypeface(typeface);
}
And this is the XML layout for the TextInputLayout
<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">
<android.support.design.widget.EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:hint="@string/set_pass"
android:inputType="textPassword"
android:maxLength="@integer/pass_max"
android:maxLines="1"
android:password="true"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
I am trying to use this code but my password hint font style is different than which I had set.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With