How to determine a long touch on android?

后端 未结 5 2149
走了就别回头了
走了就别回头了 2021-02-12 20:29

I am looking for a way for when a user long touches a mapview (lets say for 1000ms) that i can some how do a certain action.

How would i go about judging how long a use

5条回答
  •  时光说笑
    2021-02-12 20:55

    Your are probably looking for a normal long click? You will have to set your view to be long clickable by adding android:longClickable to your views xml, or by calling setLongClickable(true). Then you can add an OnLongClickListener to the view. I dont know of a way to determine exactly how long the long click is. But the default long click is the same as the google maps long click that you mentioned.

    OnLongClickListener

提交回复
热议问题