如何在 Android 中为硬件按钮设置事件处理程序?
似乎是一个简单的问题,但我找不到答案。我正在尝试编写一个使用相机拍照的活动,并且我想将 onClickListener 附加到手机本身的快门按钮,但我不知道如何引用该按钮。
Seems like a simple question, but I couldn't find an answer to it. I'm trying to write an activity that takes a picture using the camera, and I want to attach an onClickListener to the shutter button on the phone itself, but I don't know how to reference the button.
这些都是作为钥匙出现的。覆盖 onKeyDown并查找 KEYCODE_CAMERA。
These come through as keys. Override onKeyDown and look for KEYCODE_CAMERA.