3

Below is my code for EditText,

<com.google.android.material.textfield.TextInputLayout
            android:id="@+id/password_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/username_layout"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="15dp"
            app:hintEnabled="false"
            app:passwordToggleEnabled="false"
            app:passwordToggleTint="@color/white">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/login_password_input"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/login_username_input"
                android:layout_weight="0.0"
                android:drawableEnd="@drawable/password"
                android:background="@drawable/round_bg"
                android:hint="@string/login_password_hint"
                android:imeActionLabel="@string/action_done"
                android:imeOptions="actionDone"
                android:inputType="textPassword"
                android:maxLines="1"
                android:nextFocusDown="@+id/submit_btn"
                android:paddingStart="10dp"
                android:paddingLeft="10dp"
                android:text=""
                android:textColor="#FFFFFF"
                android:textColorHint="#FFFFFF"
                android:textCursorDrawable="@null"
                tools:ignore="RtlSymmetry" />
        </com.google.android.material.textfield.TextInputLayout>

I am setting password eye icon programatically like below,

passwordLayout.setEndIconMode(TextInputLayout.END_ICON_PASSWORD_TOGGLE);
                passwordLayout.setEndIconDrawable(GetDrawable.getDrawable("Show/Hide Password"));
                passwordLayout.setEndIconTintList(ColorStateList.valueOf(getResources().getColor(R.color.color_white)));

This works fine in most of the devices. But getting below issue in Mi a2 Android Version 10.

I have two TextInputLayout for user name and password field There is no issue while typing username field. Next moved to password field. Now, the cursor stucked in first position and typing text is showed up in keyboard but not displayed in Edittext field. Only text is displayed after tapping somewhere else in screen

I am not sure why this happens in some devices

Found below question related to my issue. But no solution provided there.

TextInputEditText is not showing the typed text/number when typing

UPDATE

In this given a solution for my issue, Android Pie edittext does not adjustPan/resize while typing but using Hardware acceleration may lead to high memory usage. So afraid to use this solution. is there any other way to solve this?

Sandhiya
  • 339
  • 2
  • 14
  • `EditText.invalidate()` – Darkman Feb 10 '21 at 22:50
  • @Darkman Hii.. can you explain your answer. Where I want to do this? and I am using TextInputEditText – Sandhiya Feb 11 '21 at 05:21
  • First of all, no guarantees it would work. Try calling `invalidate()` to update the UI everytime a user enter a letter or word. If it doesn't work, you're better leave a comment so that others be informed and can help you. – Darkman Feb 11 '21 at 05:33
  • @Darkman Okay will try – Sandhiya Feb 11 '21 at 05:35
  • Try removing android:background="@drawable/round_bg" from your TextInputEditText and check if the problem still exists. When you do that try also to change your textColor if needed. – MariosP Feb 11 '21 at 15:07
  • @MariosP In my case only the lower TextInputEditText has issue. Upper TextInputEditText works fine. – Sandhiya Feb 11 '21 at 15:12
  • @Sandhiya Both TextInputEditTexts have the same background drawable (round_bg) and the upper one works fine? – MariosP Feb 11 '21 at 15:19
  • @MariosP yes yes – Sandhiya Feb 11 '21 at 15:20
  • @Sandhiya This issue occur in both cases when you write the password in visible mode (plain text) and when you write the password in hidden mode? – MariosP Feb 11 '21 at 15:41
  • @MariosP No, only checked in hidden mode. Actually when moving from upper to lower TextInputEditText, cursor itself will be stuck or not displayed. – Sandhiya Feb 11 '21 at 15:46
  • @Sandhiya Can you click on the password eye icon and check if the issue still exists also in visible mode? – MariosP Feb 11 '21 at 16:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/228582/discussion-between-sandhiya-and-mariosp). – Sandhiya Feb 11 '21 at 16:03
  • Found the exact solution in below post https://stackoverflow.com/questions/54022269/android-pie-edittext-typed-text-not-showing-when-soft-keyboard-is-open – chandan Apr 03 '21 at 14:35

1 Answers1

0

I tested the code on emulator on two android devices find nothing wrong with it used com.google.android.material:material:1.3.0

  • please update your color style it has no Legiblity

her

  • pan Adjuesment related issued loged in debug check that
  • try alpha or Rc MDC for libaray version bug
  • Finally you do is open issue at MDC github here
Morpheus
  • 550
  • 1
  • 9
  • 23
  • got this issue only in Mi a2 device. Working fine in most of the devices – Sandhiya Feb 15 '21 at 05:53
  • MDC edit text actually inherited platform edit text (in this case your mi a2) if there are bug /incompatibility (most possible device end) you need to contact device manufacture or MDC github issue tracker. in most case need to find a bug where exits in device or lib itself Device Debug Log may help to identify problem you can post log – Morpheus Feb 15 '21 at 06:27