2014-04-13 7 views
0

제스처에 대한 Google Glass GDK, 미러 API 및 문서를 확인했습니다.Google Glass에서 탭 위치 얻기

짧게 누르면이 트랙 패드, 탭의 위치를 ​​결정하기 위해 어떤 방법이 KeyEvent.KEYCODE_DPAD_CENTER

으로서 검출?

감사합니다.

답변

3

X_AXIS 정보를 캡처하려면 Glass GestureDetector를 하위 클래스로 만들고 onMotionEvent (MotionEvent 이벤트)를 재정의해야합니다. 앞쪽에 가깝게 터치하면 X가 증가합니다. 1000은 정면에 있고 200은 후면을 향하고 있습니다.

package foo; 

import android.content.Context; 
import android.view.MotionEvent; 

import com.google.android.glass.touchpad.GestureDetector; 

public class CustomGestureDetector extends GestureDetector { 

    public CustomGestureDetector(Context context) { 
     super(context); 
     // TODO Auto-generated constructor stub 
    } 

    @Override 
    public boolean onMotionEvent(MotionEvent event) { 
     // TODO Auto-generated method stub 
     System.out.println(String.format("X: %.2f Y: %.2f", event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y))); 
     return super.onMotionEvent(event); 
    } 

} 
관련 문제