I have a Horizontal Layout in which some vertical layouts are dispatched.
I want to catch the onFocusEvent of my vertical layouts so when one of them gets focus, the image and the textview contained in the vertical layout changes the selector states.
I tried to test it with catching the event OnFocusChange like this :
LLContact.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View arg0, boolean hasFocus) {
// TODO Auto-generated method stub
if (hasFocus == true) {
// Has Focus
} else {
// Loses focus
}
}
});
But the event is never triggered.
I set my linear layout to "FocusableInTouchMode" as true, and Focusable as true as well, but it seems the event never happens ... Do you have any clue ?
Thanks in advance.
You need to set following properties of childs of manager textview and imageview:
focusable=false;
clickable=false;
focusable in touch mode=false;
and set these properties of layout to true;