显示为不同。我刚刚注意到,我在Galaxy S8 +(API 24)上创建和测试的AlertDialogs在我测试Galaxy Note 4(API 19)时出现了不同。我为对话框创建了一个自定义样式,它看起来就像在旧API上一样,显示了默认警报对话框和自定义主题。Android:AlertDialog背景根据API
这里是证明了该图片。
这里是我的风格和AlertDialog代码
AlertDialog风格都
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#0053f9</item>
<item name="android:textColor">#000000</item>
<item name="android:windowBackground">@drawable/background_color_blue_black_border</item>
<item name="buttonBarStyle">@style/Widget.AppCompat.ButtonBar</item>
<item name="buttonBarButtonStyle">@style/customButtonForMyDialogTheme</item>
</style>
AlertDialog代码
android.app.AlertDialog.Builder a_builder = new android.app.AlertDialog.Builder(RemoteControlBubblePillar.this, R.style.MyDialogTheme);
a_builder.setMessage("Do you want to turn on the Bubble Pillar ?")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
//Do some stuff
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
android.app.AlertDialog alert = a_builder.create();
alert.setTitle("Bubble Pillar Is Turned Off");
alert.show();
我试着将背景设置为风格透明以及在代码中将其设置为透明,但目前为止没有任何效果。任何想法为什么发生这种情况?
大,即工作。还有一个问题。我与ProgressDialogs有同样的问题,似乎只有1个导入存在进度对话框。我错过了什么吗? – Saik
解释问题..或者提出另一个问题 – ADM
感谢您的回答ADM,我实际上可以通过调整样式来修复ProgressDialog。 – Saik