• 安卓中常用的弹出框


    1.

    AlertDialog.Builder builder  = new Builder(MainActivity.this);
     builder.setTitle("确认" ) ;
     builder.setMessage("这是一个简单消息框" ) ;
     builder.setPositiveButton("是" ,  null );
     builder.show(); 

    2.

    AlertDialog.Builder builder = new Builder(MainActivity.this);
      builder.setTitle("请输入");
      builder.setIcon(R.drawable.ic_launcher);
      builder.setView(new EditText(MainActivity.this));
      builder.setPositiveButton("是" ,  null );
      builder.setNegativeButton("否", null);
      builder.show();

    3.

    AlertDialog.Builder builder  = new Builder(MainActivity.this);
    builder.setTitle("确认" ) ;
    builder.setMessage("是否确认?" ) ; 
    builder.setPositiveButton("是",null );
    builder.setNegativeButton("否", null);
    builder.show(); 

    4.

    AlertDialog.Builder builder = new Builder(MainActivity.this);
     builder.setTitle("请选择");
     builder.setIcon(R.drawable.ic_launcher);
     builder.setSingleChoiceItems(new String[]{"选项1","选项2","选项3","选项4"}, 0, new DialogInterface.OnClickListener() {
                     
                 @Override
    public void onClick(DialogInterface dialog, int which) {
              // TODO Auto-generated method stub
                      dialog.dismiss();
                 }
                   });
      builder.setNegativeButton("Cancel",null);
      builder.show();

    5.

    AlertDialog.Builder builder = new Builder(MainActivity.this);
    builder.setTitle("这是多选框");
    builder.setIcon(R.drawable.ic_launcher);
    builder.setMultiChoiceItems(new String[]{"选项1", "选项2", "选项3", "选项4"}, null, null);
    builder.setPositiveButton("sure",null);
    builder.setNegativeButton("cancel",null);
    builder.show();

    ===============================================================================================
    ***去除边框  
    AlertDialog.setView(view,0,0,0,0);
    每天积累一点,离成功就近一点
  • 相关阅读:
    python基础学习之路No.2 数据类型
    练习题 --- 猜数字游戏
    python基础学习之路No.1
    python+selenium第一步
    Self-introduction
    oracle中的number类型
    简单选项卡切换(二)
    简单选项卡切换(一)
    简单焦点轮播(二)(图片可滚动)
    简单焦点轮播(一)
  • 原文地址:https://www.cnblogs.com/apes-monkeys/p/4092593.html
Copyright © 2020-2023  润新知