Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between `focusable` and `clickable`

What is the difference between clickable and focusable in android?

like image 301
eugene Avatar asked Dec 27 '12 04:12

eugene


People also ask

What is clickable and focusable in Android?

Clickable means that it can be clicked by a pointer device or be tapped by a touch device. Focusable means that it can gain the focus from an input device like a keyboard.

What is focusable in touch mode?

Focusable in touch mode is a property that you can set yourself either from code or XML. However, it should be used sparingly and only in very specific situations as it breaks consistency with Android normal behavior.

What is the use of focusable in Android Studio?

Your view can have different background when state is focused. Focusable in touch mode allows view to gain focus when user is touching the view, good example of this kind of component is EditText . With Button or any clickable component pressed state is usually what you are interested in.


2 Answers

Clickable means that it can be clicked by a pointer device or be tapped by a touch device. 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.

like image 156
K-ballo Avatar answered Sep 20 '22 10:09

K-ballo


Focusable means ACTION_UP event will occur. It will gain it and it won't release it.

Clickable means ACTION_DOWN first and ACTION_UP at the end. It will gain and release it at the end.

like image 22
RajeshVijayakumar Avatar answered Sep 19 '22 10:09

RajeshVijayakumar