Android design support library now includes support for Snackbar.
I've used the following code to create one:
Snackbar.make(findViewById(R.id.root_layout), result, Snackbar.LENGTH_LONG)
.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View v) {
}
}).show();
The snackbar can be dismissed by a swipe. However, I also want to dismiss it using its own Action Button (created using the setAction function).
However there doesn't seem to be any function available that can do that.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…