android 消息通知的方式

方式一,Toast,几秒后自动消失

Toast.makeText(this, "通知消息", Toast.LENGTH_SHORT).show();

方式二,AlertDialog,需要点击一下才能消失

AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage("通知消息");
builder.setTitle("提示");
builder.create().show();

猜你喜欢

转载自www.cnblogs.com/liyanghui/p/11254748.html