Dialog skinning with AppCompat-v7 22 results in ugly shadows on api < 21

前端 未结 5 1449
深忆病人
深忆病人 2020-12-29 22:31

I\'m using AppCompat to write a material design styled app. Since AppCompat does not affect dialogs, I\'m skinning the dialogs as such:

styles.xml:



        
5条回答
  •  失恋的感觉
    2020-12-29 22:44

    With the new AppCompat v22.1 you can use the new android.support.v7.app.AlertDialog or the new AppCompatDialog

    Just use a code like this (of course in your case you have to use a custom layout to have the progress bar)

    import android.support.v7.app.AlertDialog
    
    AlertDialog.Builder builder =
           new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
                builder.setTitle("Dialog");
                builder.setMessage("Lorem ipsum dolor ....");
                builder.setPositiveButton("OK", null);
                builder.setNegativeButton("Cancel", null);
                builder.show();
    

    And use a style like this:

    
    

提交回复
热议问题