Android: How to add listener to hardware menu button?

前端 未结 4 1351
时光说笑
时光说笑 2021-01-01 12:09

I\'m currently trying to add a click listener to the menu hardware button. Currently I\'m just putting my onclick logic into the onCreatePanelMenu-method and return false. B

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 12:43

    try this http://developer.android.com/guide/topics/ui/menus.html#ChangingTheMenu

    If you want to change the Options Menu any time after it's first created, you must override the onPrepareOptionsMenu() method

    so the system will call onPrepareOptionsMenu() every time the user clicks Menu key

提交回复
热议问题