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; }
转载于:https://www.cnblogs.com/childyngy/p/5491977.html
相关资源:自定义Dialog样式 大小 位置