首页 > 其他 > 详细

关于dialog的一点知识

时间:2016-04-13 18:41:51      阅读:298      评论:0      收藏:0      [点我收藏+]

  一般我们比较常用的就是AlertDialog,这个一般也不直接构造,而是用系统提供的builder构造器去构造一个dialog。

  

 AlertDialog.Builder builder =  new AlertDialog.Builder(context);
 builder.setCancelable(true).setTitle("标题").setMessage("内容").setIcon(new BitmapDrawable(context.getResources())).setNegativeButton().setPositiveButton();
 builder.create();

  如上,这是比较常用的。在API21上面可以直接setView,这个方法听起来比较厉害。

  如果需要自定义布局的话,也可以,

  

                    AlertDialog dialog = new AlertDialog.Builder(context)
                        .create();
                    dialog.show();
                    dialog.setCanceledOnTouchOutside(true);
                    dialog.getWindow().setContentView(
                        R.layout.dialog_item_list_conversation);

 

关于dialog的一点知识

原文:http://www.cnblogs.com/likeshu/p/5388133.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!