码迷,mamicode.com
首页 > 其他好文 > 详细

自定义dialog布局

时间:2016-05-14 10:14:24      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

public Dialog createDialog(Context context) {
        dialog = new Dialog(context, R.style.Theme_DataSheet);
        inflater = LayoutInflater.from(context);

        view = inflater.inflate(R.layout.dialog_picture_select, null);
        view.findViewById(R.id.tv_1).setOnClickListener(this);
        view.findViewById(R.id.tv_2).setOnClickListener(this);

        Window window = dialog.getWindow();
//        window.getDecorView().setPadding(0, 0, 0, 0);
        WindowManager.LayoutParams lp = window.getAttributes();
//        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
//        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        lp.dimAmount = 0.2f;
        lp.gravity = Gravity.BOTTOM;
        dialog.onWindowAttributesChanged(lp);

        dialog.setCanceledOnTouchOutside(true);
        dialog.setContentView(view);

        return dialog;
    }

自定义dialog布局

标签:

原文地址:http://www.cnblogs.com/childyngy/p/5491977.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!