1
···
.AlertDialog.Builder dialog =new AlertDialog.Builder(UnbindBankCardActivity.this, R.style.Dialog_FS);
View view = View.inflate(UnbindBankCardActivity.this, R.layout.view_chakanshilitupian_alertdialog, null);
final AlertDialog alertDialog = dialog.create();alertDialog.setView(view);
alertDialog.show();
/** * 设置dialog宽度全屏 */
WindowManager m = getWindowManager();Display d = m.getDefaultDisplay(); //为获取屏幕宽、高android.view.WindowManager.LayoutParams params = alertDialog.getWindow().getAttributes(); //获取对话框当前的参数值、
params.width = (int) (d.getWidth()); //宽度设置全屏宽度alertDialog.getWindow().setAttributes(params);
···
//设置生效注意!!!!!!!!!!!以上设置并不能使dialog全屏,还要将dialog的style这样改将原来的
···
<style name="Dialog_FS">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowFullscreen">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
···