Axa*_*dax 11 android multi-touch android-gesture
我试图在我的应用程序中实现多点触控时,我以某种方式得到意想不到的结果.我永远不会获得多个指针的数据.我的手机上的多点触控确实有效,因为我可以使用GestureDetector捏缩放浏览器并检测捏合手势,但action=0 pointers=1无论我用多少手指触摸屏幕,下面的样本都会打印出来.
我需要在配置/ AndroidManifest或Activity创建中有什么东西
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
findViewById(R.id.ll1).setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Log.d("TAG","onTouch action="+event.getAction()+" pointers="+event.getPointerCount());
return false;
}
});
}
Run Code Online (Sandbox Code Playgroud)
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)