- AlertDialog.Builder dialog = new AlertDialog.Builder(this).setTitle(
- "title").setIcon(android.R.drawable.ic_dialog_alert).setMessage(
- "message").setPositiveButton("yes", new OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
-
- }
- }).setNegativeButton("no",
- new OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- }
- }).setCancelable(false);
-
-
-
-
- WindowManager m = getWindowManager();
- Display d = m.getDefaultDisplay();
- WindowManager.LayoutParams p = getWindow().getAttributes();
- p.height = (int) (d.getHeight() * 0.5);
- p.width = (int) (d.getWidth() * 0.8);
- dialog.show().getWindow().setAttributes(p);
-
-
-
-
-
-
-
- Window dialogWindow = dialog.show().getWindow();
- WindowManager.LayoutParams lp = dialogWindow.getAttributes();
- dialogWindow.setGravity(CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
- dialogWindow.setLayout(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- lp.x = 100;
- lp.y = 100;
- lp.width = 300;
- lp.height = 300;
- lp.alpha = 0.7f;
-
-
-
- dialogWindow.setAttributes(lp);
posted @
2014-05-15 17:31
brave-sailor
阅读(
958)
评论()
编辑
收藏
举报