[英]AlertDialog style changes
我正在制作需要AlertDialog的應用程序。 當對話框打開時,它看起來像一個Jellybean警報對話框,但是當我將代碼粘貼到另一個項目中時,它看起來就像一個Lollipop警報對話框。 為什么? (我使用AlertDialog.Builder解決方案進行對話框;如果存在其他解決方案,請說。此外,我正在使用AIDE開發環境進行編程,並且在設備上安裝了Lollipop OS。)
如果使用AppCompact樣式
您可以添加此行
<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>
並在您的代碼中導入android.support.v7.app.AlertDialog
AlertDialog.Builder builder =
new AlertDialog.Builder(this);
setContentView屬性可以使用您的自定義布局
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.custom_dialog_layout);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.