Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我们触摸/选择主屏幕以提醒 Toast/消息时(消息为“主屏幕”)。
仅用于测试/学习目的。引导我。
是否可以?
您的回答和评论对我来说都是有价值的。
指导我,谢谢。
只需将此代码段添加到您的代码中:
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub keyCode=KeyEvent.KEYCODE_HOME; Toast.makeText(this, "Home key pressed.", Toast.LENGTH_LONG).show(); return super.onKeyDown(keyCode, event); }