透明背景对话框
AlertDialog.Builder mBuilder = new AlertDialog.Builder(this, R.style.full_screen_dialog);
View view = LayoutInflater.from(this).inflate(R.layout.item_list, null);
mBuilder.setView(view);
Dialog mDialog = mBuilder.create();
Window win = mDialog.getWindow();
//显示对话框时,后面的Activity不变暗。可选操作。
win.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
win.setWindowAnimations(R.style.anim_dialog_bottom);
//获取对话框当前的參数值
WindowManager.LayoutParams params = win.getAttributes();
params.gravity = Gravity.BOTTOM;
win.setAttributes(params);
mDialog.show();
全屏风格:
<style name="full_screen_dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
</style>