【问题标题】:How to disable the functionality of home button in Android mobiles and can we set some other action for home button?如何在 Android 手机中禁用主页按钮的功能,我们可以为主页按钮设置一些其他操作吗?
【发布时间】:2013-03-27 05:47:02
【问题描述】:

如何在 Android 手机中禁用主页按钮的功能,我们可以为主页按钮设置一些其他操作吗?谁能给我一个例子。

【问题讨论】:

    标签: android-layout android-ui android-button


    【解决方案1】:

    您可以覆盖您的活动

    onKeyEvent
     public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == KeyEvent.KEYCODE_HOME) {
            // call the desired code.
            // If you want the home key disabled just uncomment the following line
            // return false;
    
        }
        return super.onKeyDown(keyCode, event);
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-15
      • 1970-01-01
      相关资源
      最近更新 更多