Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why there is warning in Android Studio clickable attribute found please also add focusable

I dont like to do much stuff in layout with xml, but I can read it well and everything is working. Why this warning is there ? I can disable it for sure, but I just don't understand it. I just want that bottom view catch click events so they don't get under, this seems working good and clickable is doing it, so I don't need focusable there at all, but I see it...

like image 448
Renetik Avatar asked Nov 22 '17 03:11

Renetik


People also ask

What does focusable mean Android?

Focusable means that it can gain the focus from an input device like a keyboard. Input devices like keyboards cannot decide which view to send its input events to based on the inputs itself, so they send them to the view that has focus.

What is clickable in Android Studio?

clickable - Defines whether this view reacts to click events.

What is Focusableintouchmode?

Focusable in touch mode is a property that you can set yourself either from code or XML.


1 Answers

For accessibility purposes. For instance, if the user is navigating through the keyboard, they can not move onto the clickable item without focusable attribute, hence cannot click.

Reference: https://android.googlesource.com/platform/tools/base/+/studio-master-dev/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/KeyboardNavigationDetector.java?autodive=0%2F

like image 122
dgngulcan Avatar answered Oct 19 '22 23:10

dgngulcan