Android通知之普通对话框通知

来源:互联网 发布:盛科网络上市了吗 编辑:程序博客网 时间:2024/06/09 20:34
//普通通知public void comm(View view){OnClickListener listener = new OnClickListener() {public void onClick(DialogInterface dialog, int which) {switch (which) {//根据按钮ID进行判断按的是哪一个按钮case DialogInterface.BUTTON_POSITIVE:Toast.makeText(getApplicationContext(), "左边", Toast.LENGTH_SHORT).show();break;case DialogInterface.BUTTON_NEUTRAL:Toast.makeText(getApplicationContext(), "中间", Toast.LENGTH_SHORT).show();break;case DialogInterface.BUTTON_NEGATIVE:Toast.makeText(getApplicationContext(), "右边", Toast.LENGTH_SHORT).show();break;}}};new AlertDialog.Builder(this)//.setTitle("普通对话框")//.setMessage("普通内容")//.setCancelable(true)//这个表示点击手机上的返回键是否能取消掉.setPositiveButton("左按钮", listener)//正面的按钮一般设置yes.setNeutralButton("中按钮", listener)//中立的按钮一般设置cancel.setNegativeButton("右按钮", listener)//负面的按钮一般设置no.show();}

0 0
原创粉丝点击