Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML attribute usage "android:focusableInTouchMode"

Tags:

android

xml

Please tell me why is the following XML attribute used ? I looked up the documentation on developer.android.com but could not understand anything.

android:focusableInTouchMode
like image 752
Aayush Avatar asked Jul 10 '14 19:07

Aayush


1 Answers

This blog post can help you to understand the meaning of touch mode.

The most relevant part :

The touch mode is a state of the view hierarchy that depends solely on the user interaction with the phone. By itself, the touch mode is something very easy to understand as it simply indicates whether the last user interaction was performed with the touch screen. For example, if you are using a G1 phone, selecting a widget with the trackball will take you out of touch mode; however, if you touch a button on the screen with your finger, you will enter touch mode. When the user is not in touch mode, we talk about the trackball mode, navigation mode or keyboard navigation, so do not be surprised if you encounter these terms. Finally, there is only one API directly related to touch mode, View.isInTouchMode().

So android:focusableInTouchMode="true" means that the view can get the focus when the phone is in touch mode.

Typically an EditText is generally focusable in touch mode and on the other hand a Button is generally not focusable in touch mode.

like image 147
ben75 Avatar answered Sep 28 '22 02:09

ben75