我正在使用触摸事件进行输入。MotionEvent.ACTION_DOWN 和 MotionEvent.ACTION_UP 都会在按下期间调用。当我的手指从表面抬起时,它应该只调用 ACTION_UP 。他们同时被召唤。请参阅以下代码和 logcat 输出。
\n\n public boolean onTouchEvent(MotionEvent e) {\n // MotionEvent reports input details from the touch screen\n // and other input controls. In this case, you are only\n // interested in events where the touch position changed.\n\n float x = e.getX();\n float y = e.getY();\n\n switch (e.getAction()) {\n case MotionEvent.ACTION_DOWN:\n mRenderer.scanButtonsDown(x, y);\n\n Log.i("Touch", "Action Down Case");\n\n case MotionEvent.ACTION_UP:\n mRenderer.scanButtonsUp(x, y);\n\n Log.i("Touch", "Action Up Case");\n\n }\n\n mPreviousX = x;\n mPreviousY = y;\n return true;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n … 绘制线条列表时遇到问题。指数发挥作用吗?如果他们这样做,他们在索引缓冲区中的顺序是什么?
我在网上找不到可靠的例子。