Returning false in OnTouch on ImageView but still event is getting consumed

前端 未结 3 684
南旧
南旧 2021-01-20 04:08

I am using ImageView.onTouch(). I am returning false for ACTION_MOVE but still the onTouch() event is consumed.

imageV         


        
3条回答
  •  无人共我
    2021-01-20 04:36

    From: http://developer.android.com/guide/topics/ui/ui-events.html

    onTouch() - This returns a boolean to indicate whether your listener consumes this event. The important thing is that this event can have multiple actions that follow each other. So, if you return false when the down action event is received, you indicate that you have not consumed the event and are also not interested in subsequent actions from this event. Thus, you will not be called for any other actions within the event, such as a finger gesture, or the eventual up action event.

    So returning false should not consume the event. How did you determine that the event was consumed?

提交回复
热议问题