Snackbar is not dismissing on swipe

后端 未结 4 1894
没有蜡笔的小新
没有蜡笔的小新 2021-02-19 02:39

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).

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 03:00

    I've written a library that supports swipe to dimiss behaviour even without providing CoordinatorLayout. Users can swipe both left or right to dismiss it (you can only swipe to right originally). It also includes progressBar and other stuff. Try it out https://github.com/tingyik90/snackprogressbar.

    All you need to do is to create a SnackProgressBar and allow swipe to dismiss. Sample code:

    SnackProgressBar messageType = new SnackProgressBar(
            SnackProgressBar.TYPE_MESSAGE, "Your message")
            .setSwipeToDismiss(true)
    

提交回复
热议问题