ImageView

ImageView is responsible for displaying images, including internal resources and external web images.

Core Attributes


Toast

Toast is a light-weight floating notification box that will disappear automatically after a few seconds.

1
2
3
4
5
6
7
8
Toast.makeText(
this,
"Some information",
Toast.LENGTH_SHORT).show();
Toast.makeText(
this,
"Some information",
Toast.LENGTH_LONG).show();

Don’t forget to invoke .show()!

Snackbar

Snackbar is another light-weight notifcation component that supports buttons. Since it can interact with users, it’s more flexible and is often used to replace Toast for information that requires fast response.

First, we have to add dependency in build.gradle

1
dependencies { implementation 'com.google.android.material:material:1.9.0' }
features Snackbar Toast
Position Bottom of screen set by setGravity()