我正在尝试获取背景DialogFragment
完全清楚。
通过设置样式项android:windowIsFloating
为 true(默认值),
这DialogFragment
完全按照我想要的方式显示,但背景非常暗。
通过设置android:windowIsFloating
设置为 false,我得到了想要的清晰背景,但 DialogFragment 会占据屏幕的 95% 左右,
在它周围只留下一个微小的间隙,你可以透过它看到它覆盖的视图。
我已经尝试了大量的调整,但似乎无法覆盖这种行为。
我需要使用PopupWindow
达到想要的效果,或者有什么风格
我可以覆盖的项目?
对我有用的是调整WinowManager.LayoutParams
in onStart()
of the 对话框片段 http://developer.android.com/reference/android/app/DialogFragment.html:
@Override public void onStart() {
super.onStart();
Window window = getDialog().getWindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.dimAmount = 0.90f;
windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(windowParams);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)