How can I be notified when a Snackbar has dismissed itself?

前端 未结 12 1506
陌清茗
陌清茗 2020-12-01 00:24

I\'m using a Snackbar from the com.android.support:design:22.2.0 library. I\'m using it to undo deletions. To make my life easier, I\'m going to make the UI loo

12条回答
  •  有刺的猬
    2020-12-01 01:18

    There is currently no way to get notification when the Snackbar has finished displaying.

    In this thread a workaround is discussed based on a timer for the duration of the Snackbar display. Snackbar in Support Library doesn't include OnDismissListener()?

    One issue to consider with this workaround is it is possible that the Snackbar duration is restarted. The material design specification for Snackbar says this will happen if an unrelated dialog or popup is displayed.

提交回复
热议问题