i have a snackbar in my appcompat activity. It has a button OK which dismiss the snackbar.It is working perfact. but i can\'t dismiss the snackbar on swipe(left to right).
Snackbars in my GLSurfaceView game don't dismiss with a swipe, and users may not know to swipe anyway if they did. The following one line of code dismisses a Snackbar with any touch of the bar. Critically I found if the user does happen to hit the action button if it has one, whatever action it is set to do is still performed. The overall dismiss does not get in the way.
snackbar.getView().setOnClickListener(view -> snackbar.dismiss());