美文网首页
简单记录一下自定义AlertDialog

简单记录一下自定义AlertDialog

作者: 我不想说 | 来源:发表于2018-11-08 18:25 被阅读10次

    private View  view ;

      private AlertDialog alertDialog;

     view  =      LayoutInflater.from(MymationActivity.this).inflate(R.layout.picker_sex_dialog_layout, null);//自定义布局

    新建一个final AlertDialog.Builder builder =new AlertDialog.Builder(MymationActivity.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK);

    builder.setCancelable(false);

    builder.setView(sexview); // 设置自己定义的布局文件作为弹出框的Content

    alertDialog = builder.create();

    alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

    alertDialog = builder.show();

    初始化布局的时候记得绑定当前的view ;

    自己可以添加点击事件什么  完全于自己的控件

    相关文章

      网友评论

          本文标题:简单记录一下自定义AlertDialog

          本文链接:https://www.haomeiwen.com/subject/nldebxtx.html