activity设置成dialog后,再设定其显示位置和高宽
WindowManagerm=getWindowManager();Displayd=m.getDefaultDisplay();//为获取屏幕宽、高LayoutParamsp=getWindow().getAttributes();//获取对话框当前的参数值p.height=(int)(d.getHeight()*1.0);//高度设置为屏幕的1.0p.width=(int)(d.getWidth()*0.7);//宽度设置为屏幕的0.8p.alpha=1.0f;//设置本身透明度p.dimAmount=0.0f;//设置黑暗度getWindow().setAttributes(p);//设置生效getWindow().setGravity(Gravity.RIGHT);//设置靠右对齐
宽高如要包裹内容
p.height=LayoutParams.WRAP_CONTENT;//高度设置为包裹
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。