First of all, I know this has been asked before: Button in custom Android Toast?. This is nearly an exact duplicate, but I think that it warrants a new question based on the
What you're referring to is not a Toast but what Google has dubbed a Snackbar. See the Material Design guidelines.
You can find several implementations of this on GitHub. Some also go by the name of UndoBar
Currently, the most extensive, popular, and active one seems to be Snackbar by nispok, which I also happen to be using.