Answer the question
In order to leave comments, you need to log in
Android onTouchEvent?
I have a listView, in the onItemLongClickListener method, I want a dialog-like view to be displayed on the screen on top of the list, with some details. When the finger is removed from the screen, we want this view to disappear. To hide the view, you need to handle the onTouchEvent event:
view.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
view.setVisibility(View.GONE);
return true;
}
return false;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question