android - key listener is not working for layout -


i want add onkeylistener linear layout not working, here code. in advance.

 innerlayout.setonkeylistener(new onkeylistener() {                  @override                 public boolean onkey(view v, int arg1, keyevent e) {                     // todo auto-generated method stub                     if(e.getkeycode()==keyevent.action_down){                          toast.maketext(homescreen.this, "down key working", toast.length_long).show();                         innerlayout.setfocusable(true);                     }                     return true;                 }             });  } 

as touch events passed child parent. if child consumes (returns true), stops; not passed parent. sure not consumed elsewhere? check this, true 1 action, false rest , super call:

@override public boolean onkeydown(int keycode, keyevent event) { super.onkeydown(keycode, event);         if (event.getaction() == keyevent.action_down) {         //toast here             return true;         }         **return false;**     }   

also, found:
onkeylistener or onkeydown not work if children views take focus
onkeydown not being called on key press on view
case? hierarchy of layouts


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -