Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TextInputEditText] Several issues with typefaces in TextInputEditText (e.g.,Typeface is not applied with textPassword inputType) #584

Open
StephaneBg opened this issue Sep 10, 2019 · 16 comments
Labels
bug Good First Issue Issues that first time contributors can work on Widget: TextField

Comments

@StephaneBg
Copy link

Description:
Typeface is not applied with textPassword inputType.

Expected behavior:
When android:inputType="text|textPassword|textNoSuggestions" (incorrect behaviour)
Screenshot_1568119309

When android:inputType="text|textNoSuggestions" (expected behaviour)
Screenshot_1568119497

Source code:

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/passwordInputAlphanumeric"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/margin_padding_size_medium"
            android:theme="@style/Widget.App.TextInputLayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            >

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/passwordAlphanumeric"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/login_hint_password"
                android:imeOptions="actionDone"
                android:inputType="text|textPassword|textNoSuggestions"
                android:maxLines="1"
                tools:ignore="Autofill,LabelFor"
                tools:text="11223344"
                />
        </com.google.android.material.textfield.TextInputLayout>


<style name="Base.TextAppearance" parent="@style/TextAppearance.AppCompat">
    <item name="android:fontFamily">@font/ubuntu_regular</item>
    <item name="fontFamily">@font/ubuntu_regular</item>
</style>

Android API version:
All

Material Library version:
1.0.0

Device:
Emulators

@ldjcmu
Copy link
Contributor

ldjcmu commented Oct 1, 2019

Also related:
When I try to set a font family in HintTextAppearance. It doesnt work.
Is there any reason?

 <style name="hintStyle" parent="TextAppearance.Design.Hint">
        <item name="android:fontFamily">@font/xyz</item>
        <item name="android:textColor">@android:color/holo_red_dark</item>
        <item name="android:textSize">12sp</item>
    </style>

** Material Library version:** Material Android Library version 1.1.0-alpha10

@ldjcmu
Copy link
Contributor

ldjcmu commented Oct 1, 2019

Also:

HintTextAppearance with textAllCaps doesn't work #586

@ldjcmu ldjcmu changed the title [TextInputEditText] Typeface is not applied with textPassword inputType [TextInputEditText] Several issues with typefaces in TextInputEditText (e.g.,Typeface is not applied with textPassword inputType) Oct 1, 2019
@carrymaster
Copy link

Also related:
When I try to set a font family in HintTextAppearance. It doesnt work.
Is there any reason?

 <style name="hintStyle" parent="TextAppearance.Design.Hint">
        <item name="android:fontFamily">@font/xyz</item>
        <item name="android:textColor">@android:color/holo_red_dark</item>
        <item name="android:textSize">12sp</item>
    </style>

** Material Library version:** Material Android Library version 1.1.0-alpha10

also not working in 1.1.0-beta02

@ezamelczyk
Copy link
Contributor

Jesus christ this library is a steaming pile of shit. Nothing is working.

@akhbulatov
Copy link

akhbulatov commented Mar 9, 2020

The same bug. Any news when this will be fixed?

@frangulyan
Copy link

Seems like the fontFamily of the inner TextInputEditText is also applied to the hint, even when the outer TextInputLayout sets it to something else using hintTextAppearance.

@vincent-paing
Copy link

vincent-paing commented Jun 17, 2020

If you write a custom typeface override to reuse all over the project programatically, it doesn't render correctly

class FontOverrideEditText @JvmOverloads constructor(
  context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : TextInputEditText(context, attrs, defStyleAttr) {

  init {
    typeface = ResourcesCompat.getFont(context, R.font.your_font)
  }

}

@dan-0
Copy link

dan-0 commented Jun 29, 2020

Is an issue on (current latest) 1.3.0-alpha01 still.

At this time, we can't use TextInputLayout because of the issue pointed out in #586 specifically. Use requires a series of focus, error, and text change listeners to determine the appearance of the TextInputLayout hint text.

@VysotskiVadim
Copy link

Looks like hintTextAppearance doesn't work because it's always overridden by the inner edit text text style. Is it expected behavior, or it's something that will be fixed?
image

@OlehHaidaienko
Copy link

A temporary workaround can be setting hint text appearance after the view layout
textInputFieldView.doOnLayout { textInputFieldView.setHintTextAppearance(R.style.TextInputFieldHintTextAppearance) }

@neild001
Copy link

Seeing the same problem would be great to see this fixed.

@kroegerama
Copy link

The bug still exists in 1.4.0-alpha02. ~1.5 years since the first report. Sometimes this library seems like it's been abandoned by its creators. 🙁

@leticiarossi and @ymarian you seem to be quite active on this component. Any news about this bug? 🙂

@mykola-dev
Copy link

the app compat widgets
the material components widgets
should we wait for 3rd iteration of UI elements library which finally would work?

@sstanislavsky
Copy link

textAllCaps for hint does not work still
Any suggestions?

@vaidadry
Copy link

vaidadry commented Apr 8, 2022

Typeface is not applied with textPassword inputType -> still appears on 1.5.0

@drchen drchen added the Good First Issue Issues that first time contributors can work on label May 4, 2022
@ipekbirinci
Copy link

I have similar problem even now. I want to make hint's font poppins and edittext's poppins_semibold but two of them became poppins_semibold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Good First Issue Issues that first time contributors can work on Widget: TextField
Projects
None yet
Development

No branches or pull requests