我想创建MATCH_PARENT宽度的DialogFragment所以对话框几乎全屏幕(离开填充周围的边缘为流动的样子)。我已经看到了这个解决方案全屏DialogFragment在Android的但我试图避免的黑客设定宽度1000dp。由于我目前的布局,无论我用FILL_PARENT或MATCH_PARENT它似乎是设置宽度和高度WRAP_CONTENT。
< LinearLayout中的xmlns:机器人=http://schemas.android/apk/res/android 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:方向=垂直>
我已经使用这个解决方案的对话框(未DialogFragment),它按预期工作:
getWindow()setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)。解决方案
尝试切换到RelativeLayout的,而不是LinearLayout中。它的工作在我的情况
I am trying to create a DialogFragment with a width of MATCH_PARENT so the dialog is nearly full screen (leaving the padding around the edges for the floating look). I have seen this solution Full Screen DialogFragment in Android but am trying to avoid the hack of setting the width to 1000dp. With my current layout, whether I use FILL_PARENT or MATCH_PARENT it seems to be setting the width and height to WRAP_CONTENT.
<LinearLayout xmlns:android="schemas.android/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >I have used this solution for Dialog (not DialogFragment) and it works as expected:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);解决方案
try to switch to RelativeLayout instead of LinearLayout. It worked in my case
更多推荐
全屏DialogFragment
发布评论