Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android studio xml file with edittext gives error : titletxt <EditText>: Touch target size too small how to fix

i have simple android application containing xml file with simple edittext and button and recycler view below my xml file

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <EditText
            android:id="@+id/titletxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="24dp"

            android:hint="Enter Information"

            app:layout_constraintBottom_toTopOf="@+id/button"
            app:layout_constraintEnd_toEndOf="parent"

            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"

            android:layout_marginTop="20dp"
            android:layout_marginBottom="40dp"
            android:text="Submit"
            app:layout_constraintBottom_toTopOf="@+id/recycler"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.498"
            app:layout_constraintStart_toStartOf="parent" />

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E8DDDD"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

when i build the app or run it it gives the error below

titletxt : Touch target size too small

like image 600
Malo Avatar asked Sep 19 '25 20:09

Malo


1 Answers

Edit Text's height is 45dp. Minimum required height of this touch target is 48dp or larger.

You can find more information at https://support.google.com/accessibility/android/answer/7101858

Just add android:minHeight="48dp" to the editText.

like image 90
Vikalp Vashisth Avatar answered Sep 21 '25 10:09

Vikalp Vashisth