顯示爲不同。我剛剛注意到,我在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