zoukankan      html  css  js  c++  java
  • 安卓中常用的弹出框

    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);
    每天积累一点,离成功就近一点
  • 相关阅读:
    Sort函数的相关知识
    javascript常用排序算法总结
    机票项目辅助类
    解析机票舱位和子舱位方法
    一个哥们总结的技术知识点
    随鼠标移动的div
    【转】Qt在pro中设置运行时库MT、MTd、MD、MDd,只适合VS版本的Qt
    C++异常及捕获_01
    Qt5_QString_测试
    Qt5_容器_知识点记录
  • 原文地址:https://www.cnblogs.com/apes-monkeys/p/4092593.html
Copyright © 2011-2022 走看看