Using XML Attributes "android: focusableInTouchMode"

Please tell me why the following XML attribute is used? I looked at the documentation on developer.android.com, but didnโ€™t understand anything.

android:focusableInTouchMode 
+7
android xml
source share
2 answers

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

The most important part:

Touch mode is a state of the hierarchy of views, which depends solely on the userโ€™s interaction with the phone. The touch mode itself is something very easy to understand, as it simply indicates whether there was a recent user interaction with the touch screen. For example, if you use a G1 phone, selecting a widget with a trackball will take you out of touch mode; however, if you touch the buttons on the screen with your finger, you will enter the touch mode. When the user is not in touch mode, weโ€™re talking about trackball mode, navigation mode or keyboard navigation, so donโ€™t be surprised if you come across these conditions. Finally, there is only one API directly related to touch mode, View.isInTouchMode ().

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

Normally EditText usually focuses in touch mode, and on the other hand, a Button usually does not focus in touch mode.

+6
source share

What happened to me when I did not have the correct number of elements in getItemCount ().

Double check that you have the correct number of items!

+1
source share

All Articles