Snackbars can actually replace toasts and can be used instead. Of course, it can be noted that they can not replace toasts, but they can be considered as a new version of toasts. Snackbars are the tapes that are used to inform users when certain tasks or events are taking place.
What is a Snackbar?
To give a complete explanation of snackbars, we will give an example so that we can better explain it. Consider the Gmail environment, where after sending a message to people, a message appears to the user that your message was sent and displays two buttons for the user that the user can delete or view again. This bar that is displayed to the user after the event is called Snackbar.Or in other cases, if the user deletes the sent message, the system will receive the message "Message is deleted".Another example to better understand Snackbar, we can say that a message is displayed for the user at the bottom that the system is not connected to the Internet, in this case, in addition to displaying the message to the user, a button to perform an action It shows that the user can take the necessary actions.In fact, the bar that is displayed in the system for information to the user and there is a button next to the action is called Snackbar.In the example of Gmail, the button to delete the message and in the example of not connecting to the Internet can be considered the action and the button of retry.Therefore, it can be said that one of the advantages and features of Snackbar over Toast is that in addition to displaying the appropriate message with the event for the user, it is also possible to put a button to perform the action.
How to build a Snackbar project
1- In Android Studio, we create a new project and select the desired name for it. The name chosen in this tutorial is Snackbar.2- It is better to create the project with MinSDK 17 in Android Studio.3- Add the following codes inside the project:
dependencies {
implementation fileTree (dir: 'libs', include: ['* .jar'])
implementation 'com. android. support: appcompat-v7:27.0.2'
implementation 'com. android. support:design:27.0.2'
}
4- The view in the Snackbar must be of the CoordinatorLayout type so that the snack bar capabilities can work properly.
Read more on:https://www.dotnek.com/Blog/Apps/what-are-snackbars-in-android-systems-and-how
link:https://dotnek.mystrikingly.com/
Related link:Android Development
:: برچسبها:
dotnek ,
seo ,
site ,
:: بازدید از این مطلب : 82
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0