我的onTouch监听器中没有从三星S-Pen获得手写笔按钮事件。一切都在onHover上工作正常。
hoverListener = new View.OnHoverListener() {
public boolean onHover(View v, MotionEvent event) {
Log.i("TEST", "tooltype = " + event.getToolType(0) + ", button = " + event.getButtonState());
return false;
}
};
touchListener = new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
Log.i("TEST", "tooltype = " + event.getToolType(0) + ", button = " + event.getButtonState());
return false;
}
};
backgroundView.setOnTouchListener(touchListener);
backgroundView.setOnHoverListener(hoverListener);