【问题标题】:Fragment Dialog landscape, fill screenFragment Dialog 横向,全屏
【发布时间】:2014-12-07 03:32:33
【问题描述】:

我有一个片段对话框的问题,如果手机处于纵向模式,一切都很好,对话框几乎是全屏的,但是当我旋转手机时,横向有一些很大的间隙。有可能解决这个问题吗?

我称之为

        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

摆脱 DIAlogFragment 标题。 我正在使用线性布局。

【问题讨论】:

  • @LittleChild 对该问题执行 CTRL + F。告诉我你是否找到“风景”这个词。谢谢。
  • 如果你只阅读而不是 CTRL+F android:layout_width="fill_parent" android:layout_height="fill_parent"

标签: android android-dialogfragment


【解决方案1】:

解决办法:

@Override
public void onStart()
{
    super.onStart();
    Dialog dialog = getDialog();
    if (dialog != null)
    {
        int width = ViewGroup.LayoutParams.MATCH_PARENT;
        int height = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.getWindow().setLayout(width, height);
    }
}

将此添加到您的对话框片段中。

【讨论】:

    猜你喜欢
    • 2012-08-24
    • 1970-01-01
    • 1970-01-01
    • 2015-03-07
    • 2022-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多