1、Toast 2、弹出框 2.2单选 2.3多选框 用的次数很多可以封装一下 在Bill_head.java中调用 其他类似
Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { //放在UI线程弹Toast Toast.makeText(Setting.this, "正在更新请稍后", Toast.LENGTH_LONG).show(); } });
2.1默认样式
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(AlertDialogActivity.this); builder.setTitle("提示"); builder.setMessage("更新成功"); builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(AlertDialogActivity.this, "确定了",Toast.LENGTH_SHORT).show(); } }); builder.setNeutralButton("取消", null); builder.show();
final String[] gender = new String[]{"java","android"}; android.support.v7.app.AlertDialog.Builder builder1=new android.support.v7.app.AlertDialog.Builder(AlertDialogActivity.this); builder.setTitle("请选择"); builder.setItems(gender, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ToastUtil.showMsg(AlertDialogActivity.this,gender[which]); } }); builder.show();
android.support.v7.app.AlertDialog.Builder builder2=new android.support.v7.app.AlertDialog.Builder(AlertDialogActivity.this); builder.setTitle("你最喜欢吃一下那种菜肴:"); final String[] dish =new String[]{"红烧牛肉","粉蒸排骨"}; builder.setSingleChoiceItems(dish, 1, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ToastUtil.showMsg(AlertDialogActivity.this,dish[which]); dialog.dismiss(); } }); builder.setCancelable(false); builder.show(); break;
String[] dessert = new String[]{"抹茶千层","芒果拿破仑"}; boolean[] begin = new boolean[]{false,false}; android.support.v7.app.AlertDialog.Builder builder3=new android.support.v7.app.AlertDialog.Builder(AlertDialogActivity.this); builder.setTitle("你吃过以下哪些甜点"); builder.setMultiChoiceItems(dessert, begin, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { } }); builder.setPositiveButton("确认",null); builder.setNegativeButton("取消",null); builder.show(); break;
Prompt.javapublic class Promptextends MyApplication { public static void Bill_headtk(final Bill_head ym,final String nr) { new Thread(new Runnable() { @Override public void run() { Handler handler = new Handler(Looper.getMainLooper()); handler.post(new Runnable() { @Override public void run() { //放在UI线程弹Toast AlertDialog.Builder builder=new AlertDialog.Builder(ym); builder.setTitle("提示"); builder.setMessage(nr); builder.setPositiveButton("确定",null); builder.show(); } }); } }).start(); } }
Prompt.Bill_headtk(Bill_head.this, "请输入");
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算