Translate

Wednesday, December 20, 2017

Focus problems for listview rows android


I have faced one strange issue  :
My listview rows were not selecting through Bluetooth keyboard
Tryed to select rows through Bluetooth keyboard arrow keys but no row getting focus.




Solution 1 : Initially tried android:focusable="true" and it is getting focus for each row but click funtionlity of that row is not working.

Solution 2 : Tried following tag and everything works perfectly.

android:descendantFocusability="blocksDescendants".

android:descendantFocusability

Defines the relationship between the ViewGroup and its descendants when looking for a View to take focus.
Must be one of the following constant values.
ConstantValueDescription
afterDescendants1The ViewGroup will get focus only if none of its descendants want it.
beforeDescendants0The ViewGroup will get focus before any of its descendants.
blocksDescendants2The ViewGroup will block its descendants from receiving focus.

No comments:

Post a Comment

Could not identify launch activity: Default activity not found : Error while Launching activity

Problem : I got this Error , When I tried to create an application without any Activity . Basically like to develop an Android Headless appl...