![](/img/trans.png)
[英]how to detect the secondary finger on touching the screen not at same time in android touchlistener?
[英]Android: Is it possible to handle a click while another finger is already touching the screen?
我是Android開發的初學者,我正在為小孩子開發一款應用程序。 如你所知,孩子們傾向於用一只手握住屏幕(它已經觸摸屏幕)並用另一只手點擊屏幕。 不幸的是,這會使屏幕無法響應點擊次數。 我的問題是,有沒有辦法讓屏幕響應一次點擊,即使它已被一根手指觸摸?
還有就是,在你處理onTouchEvent()
的MotionEvent
ACTION_POINTER_DOWN
。 想象一下,當多個手指觸摸屏幕時,您想要顯示Toast
; 你可以這樣做:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN) {
Toast.makeText(this, "More than one finger on screen", Toast.LENGTH_SHORT);
}
}
您可以查看多點觸控Android開發人員頁面 ,了解有關該主題的更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.