| Id | SmallTouchTargetSize |
| Summary | Targets are smaller than recommended guidelines, reducing tap accuracy |
| Severity | Warning |
| Category | Touch Interaction |
| Affects | Resource files and Kotlin and Java files |
| Implementation | Custom lint rule – checks declared size of clickable views in static code to flag touch targets smaller than recommended minimum (e.g., 48dp) |
Interactive elements like buttons, links, and controls are difficult to tap accurately, requiring multiple attempts or precise finger placement to activate successfully.
Small touch targets are hard to activate accurately, especially for users with larger fingers or limited dexterity. This increases the chance of errors and can make the interface frustrating or unusable.
<!-- Button too small for accessible touch target -->
<Button
android:id="@+id/close_button"
android:layout_width="24dp"
android:layout_height="24dp"
android:text="X" />
class MainActivity : AppCompatActivity() {
private fun createSmallButton() {
val button = Button(this)
button.layoutParams = ViewGroup.LayoutParams(
24.dpToPx(), // Too small
24.dpToPx() // Too small
)
}
}