我有一个 SnackBar,我想在完成当前视图后显示在另一个视图上。这是一个发送表单,所以当我单击发送按钮时,我希望 SnackBar 出现在另一个活动中,因为发送表单将被关闭。这是代码:
final Snackbar snackSuccess = Snackbar.make(***ViewToModifyHere?***, "Signal successfully sent.", Snackbar.LENGTH_LONG)
.setAction("Action", null)
.setDuration(2500);
snackSuccess.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View view) {
snackSuccess.dismiss();
}
});
snackSuccess.setActionTextColor(Color.GREEN);
snackSuccess.setCallback(new Snackbar.Callback() {
@Override
public void onDismissed(Snackbar snackbar, int event) {
super.onDismissed(snackbar, event);
if (event != DISMISS_EVENT_ACTION) {
}
}
});
snackSuccess.show();
finish();