Luk*_*kap 5 android themes dialog coding-style android-gui
当我运行此代码时,会显示警告对话框,但对话框周围有一个白色边框,边框也很小.我不想要这个白色边框,我希望有90度角的真正角落.我希望你明白我想要做什么.
AlertDialog.Builder ad = new AlertDialog.Builder(this);
Button bbb=new Button(MvcnContactList.this);
ad.setView(bbb);
alertDialog = ad.create();
alertDialog.show();
Run Code Online (Sandbox Code Playgroud)

是否有任何方式来设置警报对话框,但不是文本颜色或文本大小或类似的东西...我想设置警报对话框的边框,所以设置一个主题可能是这个问题的解决方案.但我不知道要覆盖哪些属性.
谢谢,
编辑:例如这个样式覆盖textColor为00FF00,这很酷,但我应该覆盖哪个属性,使角落不圆,并删除那个白洞
<?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>
Run Code Online (Sandbox Code Playgroud)
Luk*_*kap 15
我找到了包装器的解决方案,您可以在其中为当前上下文中的任何内容设置主题(样式).我将R.style.MyTheme设置为我的警报对话框,我根据自己的喜好定制了该视图.
ContextThemeWrapper ctw = new ContextThemeWrapper( this, R.style.MyTheme );
AlertDialog.Builder builder= new AlertDialog.Builder( ctw );
Run Code Online (Sandbox Code Playgroud)