androidkotlinandroid-edittextpasswordsandroid-tiramisu

EditText backspace doesn't work using soft keyboard


I have an EditText for password input (android:inputType="textPassword"). I am facing a really weird issue that it doesn't allow user to delete characters using the soft keyboard on my emulator or on a device, but it works perfectly on an emulator with my computer's keyboard. It also works fine in all cases if I change the input type to something that's not for password like textEmailAddress.

My code is as below, which is really nothing special/interesting, and I am using targeting API 33:

<EditText
    android:id="@+id/password_edit_text"
    android:layout_width="match_parent"
    android:layout_height="@dimen/onboarding_input_height"
    android:layout_marginHorizontal="@dimen/padding_large"
    android:layout_marginTop="@dimen/padding_large"
    android:hint="@string/password_label"
    android:inputType="textPassword"
    android:maxLines="1"
    android:paddingStart="@dimen/padding_large"
    android:paddingEnd="@dimen/onboarding_password_input_end_padding"
    android:textSize="@dimen/text_medium"
    app:layout_constraintBottom_toTopOf="@id/sign_in_error_text"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/email_auxiliary_text" />

Thanks in advance for any insights!


Solution

  • If you have setOnKeyListener it should return false for events to get triggered.