我的解决方案可以工作,但是使用公共static int计数有多少根手指却很难.在我用两根手指猛扑后,我不得不将fingercount设置为1,因为我再也无法用一根手指获得action_pointer_down了…我不知道为什么…但是这种解决方案也可以用于更多的手指…希望有人可以使用它在功能中
public class RemoteFragment extends Fragment{
public static int fingercount = 1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final GestureDetector gdt = new GestureDetector(getActivity(),
new RemoteGestureListener());
View view = inflater.inflate(R.layout.gestures, container, false);
view.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(final View view, final MotionEvent event) {
int action = event.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_POINTER_DOWN:
Log.d(TAG,
"