Before coming with focus, let’s go through 2 scenarios :
– There’re some EditTexts on screen, the first is focused. When user press NEXT button on soft keyboard, the pointer will move to next one with order from left to right, top to bottom. So what should we do when need to change the default focus movement order on Android?
– When user focus on an EditText, platfrom makes it hightlight and shows soft keyboard up. And the question is how do we customize action happen when one view get focus ?
In my two cents, these’re the most common necessary knowledge when we work with focus on Android.
A view indicate its readiness to take focus through isFocusable() function. However we can change this attribute by call function setFocusable(boolean). Beside we also can specify view can take focus on touch mode or not through function setFocusableInTouchMode(boolean). After make view focusable, we can customize focus movement or action when focus happends. Continue reading