Password Hint text does not have correct font applied
See original GitHub issueIf i try to use calligraphy for a password field as such:
<EditText
style="@style/AppTheme.Font.Lgt"
android:id="@+id/passwordText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimens/text_size_med"
android:hint="@string/password_hint"
android:inputType="textPassword"
android:text=""/>
It seems that the inputType attribute is forcing the hint into being monospaced (which seems to be odd, but normal android behavior with EditText). In this case, the font being applied by the style is ignored. Presumably because it is applied prior to android applying the inputType, and thus the typeface is getting overriden.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:16 (6 by maintainers)
Top Results From Across the Web
Password hint font in Android - Stack Overflow
I acquired the custom typeface from username EditText and applied it to TextInputLayout of the password field. Now you don't need to set...
Read more ><input type="password"> - HTML: HyperText Markup Language
If the specified pattern is not specified or is invalid, no regular expression is applied and this attribute is ignored completely. Note: Use ......
Read more >Don't Use The Placeholder Attribute - Smashing Magazine
For someone who has never encountered it before, placeholder text may look like entered content, causing them to skip over the input. If...
Read more >Working with the EditText | CodePath Android Cliffnotes
The EditText is the standard text entry widget in Android apps. ... If you do not see these styles applied within a DialogFragment,...
Read more >ion-input: Custom Input Value Type Styling and CSS Properties
Types. The input component is meant for text type inputs only, such as "text" , "password" , "email ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@here @mattinger I try this way:
1.- remove android:inputType=“textPassword” from xml 2.- apply typeface using this great library @chrisjenx thanks 3.- set passwordtransformation in code: password.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); // No suggestions password.setTransformationMethod(PasswordTransformationMethod.getInstance());
DONE !!
@Sanjay-F if you use TextView.setInputType() with any of:
…then Android applies a Monospace typeface.
Note: you need to bitwise OR the above variations with the appropriate:
…when calling TextView.setInputType() otherwise Android doesn’t change the transformation type.
If for example you are using a button to toggle a password to be visible or not, you’ll have to manually set the Typeface after each call to setInputType() if you want to apply a custom Typeface. When toggling password visibility Android appears to reset the cursor position to the start of the EditText, so this snippet also sets the cursor to the end of the EditText.