首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

随便地方显示对话框

2012-08-29 
任意地方显示对话框AlertDialog.Builder builder new AlertDialog.Builder(this)? ?LayoutInflater inf

任意地方显示对话框

AlertDialog.Builder builder = new AlertDialog.Builder(this);? ?LayoutInflater inf = getLayoutInflater();? ? View layout = inf.inflate(R.layout.main, null);? ? builder.setView(layout);? ? builder.setTitle("Add to Home screen");AlertDialog dialog = builder.create();? ? WindowManager.LayoutParams WMLP = dialog.getWindow().getAttributes();? ? int dialogOriginalHeight = WMLP.height;WMLP.height += 750;Log.i("XnY", "x="+WMLP.x+", y="+WMLP.y);WMLP.x = -10; ? //x positionWMLP.y = -10; ? //y positionLog.i("XnY", "x="+WMLP.x+", y="+WMLP.y);dialog.getWindow().setAttributes(WMLP);Log.i("POSITION", "POS::HEIGHT:"+WMLP.height);dialog.show();

热点排行