<bdo id='L4rOX'></bdo><ul id='L4rOX'></ul>

    <small id='L4rOX'></small><noframes id='L4rOX'>

    1. <tfoot id='L4rOX'></tfoot>

    2. <i id='L4rOX'><tr id='L4rOX'><dt id='L4rOX'><q id='L4rOX'><span id='L4rOX'><b id='L4rOX'><form id='L4rOX'><ins id='L4rOX'></ins><ul id='L4rOX'></ul><sub id='L4rOX'></sub></form><legend id='L4rOX'></legend><bdo id='L4rOX'><pre id='L4rOX'><center id='L4rOX'></center></pre></bdo></b><th id='L4rOX'></th></span></q></dt></tr></i><div id='L4rOX'><tfoot id='L4rOX'></tfoot><dl id='L4rOX'><fieldset id='L4rOX'></fieldset></dl></div>
    3. <legend id='L4rOX'><style id='L4rOX'><dir id='L4rOX'><q id='L4rOX'></q></dir></style></legend>

      如何让 Dialog 样式的活动窗口填满屏幕?

      时间:2023-08-31

          <tbody id='WD84A'></tbody>
        <i id='WD84A'><tr id='WD84A'><dt id='WD84A'><q id='WD84A'><span id='WD84A'><b id='WD84A'><form id='WD84A'><ins id='WD84A'></ins><ul id='WD84A'></ul><sub id='WD84A'></sub></form><legend id='WD84A'></legend><bdo id='WD84A'><pre id='WD84A'><center id='WD84A'></center></pre></bdo></b><th id='WD84A'></th></span></q></dt></tr></i><div id='WD84A'><tfoot id='WD84A'></tfoot><dl id='WD84A'><fieldset id='WD84A'></fieldset></dl></div>
      • <legend id='WD84A'><style id='WD84A'><dir id='WD84A'><q id='WD84A'></q></dir></style></legend>
          <bdo id='WD84A'></bdo><ul id='WD84A'></ul>

          <small id='WD84A'></small><noframes id='WD84A'>

          1. <tfoot id='WD84A'></tfoot>

                本文介绍了如何让 Dialog 样式的活动窗口填满屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用带有对话框主题集的活动,我希望它是全屏的.我尝试了各种方法,甚至通过 WindowManager 手动将窗口扩展到全宽和全高,但没有任何效果.

                I am using an activity with the dialog theme set, and I want it to be full screen. I tried all sorts of things, even going through the WindowManager to expand the window to full width and height manually, but nothing works.

                显然,对话窗口(或具有对话主题的活动)只会根据其内容展开,但即使这样也并不总是有效.例如,我展示了一个进度条圆圈,它的宽度和高度都设置为 FILL_PARENT(它的布局容器也是如此),但对话框仍然围绕着小得多的进度条而不是填充屏幕.

                Apparently, a dialog window (or an activity with the dialog theme) will only expand according to its contents, but even that doesn't always work. For instance, I show a progress bar circle which has width and height set to FILL_PARENT (so does its layout container), but still, the dialog wraps around the much smaller progress bar instead of filling the screen.

                一定有一种方法可以在对话框窗口中显示一些小东西,但让它扩展到全屏大小而不调整其内容大小?

                There must be a way of displaying something small inside a dialog window but have it expand to full screen size without its content resizing as well?

                推荐答案

                我找到了解决方案:

                在您设置了 Theme.Dialog 样式的活动中,执行以下操作:

                In your activity which has the Theme.Dialog style set, do this:

                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                
                    setContentView(R.layout.your_layout);
                
                    getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
                }
                

                重要的是你调用Window.setLayout() 你调用setContentView(),否则它不会工作.

                It's important that you call Window.setLayout() after you call setContentView(), otherwise it won't work.

                这篇关于如何让 Dialog 样式的活动窗口填满屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:启用 GPS 的 LocationSettingsRequest 对话框 - 跳过了 下一篇:Android:在什么情况下出现对话框会导致 onPause() 被

                相关文章

                最新文章

              1. <tfoot id='JJ3bj'></tfoot>
              2. <legend id='JJ3bj'><style id='JJ3bj'><dir id='JJ3bj'><q id='JJ3bj'></q></dir></style></legend>

                <small id='JJ3bj'></small><noframes id='JJ3bj'>

                  <bdo id='JJ3bj'></bdo><ul id='JJ3bj'></ul>

                <i id='JJ3bj'><tr id='JJ3bj'><dt id='JJ3bj'><q id='JJ3bj'><span id='JJ3bj'><b id='JJ3bj'><form id='JJ3bj'><ins id='JJ3bj'></ins><ul id='JJ3bj'></ul><sub id='JJ3bj'></sub></form><legend id='JJ3bj'></legend><bdo id='JJ3bj'><pre id='JJ3bj'><center id='JJ3bj'></center></pre></bdo></b><th id='JJ3bj'></th></span></q></dt></tr></i><div id='JJ3bj'><tfoot id='JJ3bj'></tfoot><dl id='JJ3bj'><fieldset id='JJ3bj'></fieldset></dl></div>