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

    <tfoot id='NBNiN'></tfoot>
      <bdo id='NBNiN'></bdo><ul id='NBNiN'></ul>

  1. <small id='NBNiN'></small><noframes id='NBNiN'>

    <legend id='NBNiN'><style id='NBNiN'><dir id='NBNiN'><q id='NBNiN'></q></dir></style></legend>

    1. 更改 AlertDialog 的样式

      时间:2023-08-30
        <tbody id='3FDmJ'></tbody>

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

            <small id='3FDmJ'></small><noframes id='3FDmJ'>

            • <bdo id='3FDmJ'></bdo><ul id='3FDmJ'></ul>
              <legend id='3FDmJ'><style id='3FDmJ'><dir id='3FDmJ'><q id='3FDmJ'></q></dir></style></legend>

                本文介绍了更改 AlertDialog 的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                当我运行此代码时,会显示警报对话框,但对话框周围有一个白色边框,而且边框有点圆.我不想要这个白色边框,我想要真正的角为 90 度.我希望你明白我在做什么.

                When I run this code the alert dialog is shown but there is one white border around the dialog and also the borders are little round. I do not want this white border and I want to have real corners with angle of 90. I hope you understand what I am trying to do.

                        AlertDialog.Builder ad = new AlertDialog.Builder(this);
                        Button bbb=new Button(MvcnContactList.this);
                        ad.setView(bbb);
                        alertDialog = ad.create();
                        alertDialog.show();
                

                有什么方法可以设置警报对话框的样式,但不能设置文本颜色或文本大小或类似的样式...我想设置警报对话框的边框样式,因此仅设置一个主题也许可以解决此问题.但我不知道要覆盖哪些属性.

                Is there any way to style the alert dialog but not the text color or text size or something similar... I want to style the borders of the alert dialog, so setting just a theme maybe it is solution to this problem. But I do not know what properties to override.

                谢谢,

                例如,这种样式将 textColor 覆盖为 00FF00 ,这很酷,但是我应该覆盖哪个属性以使角不圆并移除那个白色的钻孔

                For example this style override the textColor to 00FF00 , and that is cool, but which property should I override to make the corners not round and tho remove that white boreder

                <?xml version="1.0" encoding="utf-8"?>
                <resources>
                    <style name="AlertDialogCustom" parent="@android:style/AlertDialog">
                        <item name="android:textColor">#00FF00</item>
                        <item name="android:typeface">monospace</item>
                        <item name="android:textSize">10sp</item>
                    </style>
                </resources>
                

                推荐答案

                我找到了使用包装器的解决方案,您可以在其中为当前上下文中的任何内容设置主题(样式).我将 R.style.MyTheme 设置为警报对话框的样式,并根据自己的喜好定制了该视图.

                I found solution with the wrapper, where you can set a theme (style) to anything in the current context. I set R.style.MyTheme as style to my alert dialog and I customized that view to my own taste.

                ContextThemeWrapper ctw = new ContextThemeWrapper( this, R.style.MyTheme );
                        AlertDialog.Builder builder= new AlertDialog.Builder( ctw );
                

                这篇关于更改 AlertDialog 的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在 Android 主屏幕中弹出对话框 下一篇:Android异常“指定的孩子已经有一个父母......&qu

                相关文章

                最新文章

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

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

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

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