question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TextInputLayout] Counter is hidden by keyboard

See original GitHub issue

Description: If app:counterEnabled=“true” is set in a TextInputLayout, whenever a user opens a keyboard to type in something, the counter is hidden by the keyboard thus defeating its purpose of letting the user know how much he/she has typed and how much character(s) are left.

Expected behavior: The expected behavior, IMHO, would be to make the modify the component in such a way that the keyboard no longer hides the counter and allows the user to know how much character(s) he/she is left to type.

Source code:

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/textInputDescriptionLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/TextInputLayoutAppearance"
        app:counterEnabled="true"
        app:counterMaxLength="35">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/tvDescription"
            style="@style/Text12RegularBlack"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:digits="@string/account_holder_name_input_keys"
            android:hint="@string/description"
            android:imeOptions="actionDone"
            android:inputType="textFilter"
            android:maxLength="35"
            android:paddingBottom="@dimen/padding_16dp"
            android:textSize="@dimen/text_size_16sp" />
    </com.google.android.material.textfield.TextInputLayout>

Android API version: 29

Material Library version: 1.1.0-alpha08

Device: Pixel 2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
leticiarossicommented, May 26, 2020

We set it to true on the TextInputEditText’s default style here! https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/textfield/res/values/styles.xml#L178 so the R.styleable.TextInputEditText_textInputLayoutFocusedRectEnabled will be true by default

0reactions
drchencommented, Feb 18, 2022

Looks like we can close the issue. : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - TextInputLayout counter hides when keyboard appear
TextInputLayout counter hides when keyboard appear [duplicate] ; Add screen shot, which can make better explanation. – Pankaj Kumar. May 23, 2016 ...
Read more >
Error/counter text in TextInputLayout is covered by keyboard ...
The TextInputLayout contains an EditText which in turn receives the input from the user. With TextInputLayout introduced with the Android Design Support ...
Read more >
TextInputLayout | Android Developers
The TextInputLayout will show a clear text button while there is input in the EditText. Clicking it will clear out the text and...
Read more >
Android TextInputLayout Example | DigitalOcean
Android TextInputLayout is a design component that comes with the Material ... Styling the counter is similar to styling the hint text.
Read more >
Working with the EditText Android 23.06.2017
getText().toString(); Toast.makeText(activity, text, Toast.LENGTH_SHORT).show(); // hide keyboard //InputMethodManager inputManager = ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found