android - Why it won't detect onTouch? -
my actionbar called pressing "menu button" this. , it's working fine
@override public boolean onkeydown(int keycode, keyevent event) { if(keycode == keyevent.keycode_menu){ if (mactionbar.isshowing()) { mactionbar.hide(); } else { mactionbar.show(); } }else if(keycode == keyevent.keycode_back){ webview mywebview = (webview)findviewbyid(r.id.webview1); mywebview.goback(); } return true; }
when user touches screen while actionbar shown, actionbar should disappear.
won't detect ontouch event. why?
public boolean ontouch(view view, motionevent event) { switch(event.getaction() & motionevent.action_mask) { case motionevent.action_down: if (mactionbar.isshowing()) { mactionbar.hide(); } case motionevent.action_up: break; case motionevent.action_pointer_up: break; } return true; }
update:
view.ontouchlistener mdelayhidetouchlistener = new view.ontouchlistener(){ public boolean ontouch(view view, motionevent event) { switch(event.getaction() & motionevent.action_mask) { case motionevent.action_down: if (mactionbar.isshowing()) { mactionbar.hide(); } case motionevent.action_up: break; case motionevent.action_pointer_up: break; } return true; } };
it still won't work:(
change return value false
return false;
Comments
Post a Comment