Android相机按钮一半pressed监听器 [英] Android Camera Button Half Way Pressed Listener
问题描述
我试图寻找这个答案,但无法找到一个。
I have tried looking for an answer for this but was unable to find one.
我建立一个自定义的相机应用,并已掌握了一些基本的工作。我也能够从初始化真正的相机应用挡住相机按钮。我想这样做的唯一的事情就是建立在自动对焦时,相机按钮一半pressed。
I am building a custom camera app and have got the basics to work. I have also been able to block the camera button from initializing the real camera app. The only thing that I would like to do is build in autofocus when the camera button is half pressed.
我很舒服使用camera.autofocus,但无法找到一个方法来侦听摄像头按钮半途而废pressed(如默认的相机应用也)启动自动对焦电话。
I am comfortable using camera.autofocus, but cannot find a way to listen for the camera button to be halfway pressed (like the default camera app does) to start the autofocus call.
所以,如果有人能告诉我,如果有一个关键的code或另一种方式来听pssed它的拍照键感德$ P $的中途点,这将有助于我很多东西。
感谢
推荐答案
我有一个小的创意,只是在Android的烤任意键按下事件。我最终找出了关键code相机的重点是80这样。这也与Android文档相匹配,一旦我知道我一直在寻找。
I got a little creative and just toasted any key down event in android. I ended up finding out that the key code for camera focus is 80 this way. This also matches up with the android documentation once I knew what I was looking for.
http://developer.android.com/reference/android/view/ KeyEvent.html
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction()==KeyEvent.ACTION_DOWN){
Toast.makeText(this, new Integer(keyCode).toString(), Toast.LENGTH_LONG).show();
return true;
}
return false;
}
希望这会帮助别人。
Hope this helps others.
这篇关于Android相机按钮一半pressed监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!