Android - Snackbar vs Toast - usage and difference

前端 未结 9 1994
温柔的废话
温柔的废话 2020-12-08 03:28

We have been using just Toasts in our application so far and as we are planning to adopt some new features from Support Design Library I am wondering what\'s the recommended

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-08 04:19

    According to the official documentation at Pop-up messages overview:

    Note: The Snackbar class supersedes Toast. While Toast is currently still supported, Snackbar is now the preferred way to display brief, transient messages to the user.

    and (Material Design) Snackbars's documentation:

    Related concepts: Android also provides a Toast class with a similar API that can be used for displaying system-level notifications. Generally, snackbars are the preferred mechanism for displaying feedback messages to users, as they can be displayed in the context of the UI where the action occurred. Reserve Toast for cases where this cannot be done.

提交回复
热议问题