欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

2020-08-13

程序员文章站 2022-03-20 08:30:13
AlertDialog You need to use a Theme.AppCompat theme (or descendant) with this activity.解决方案:将:super(context);修改为super(context,R.style.AppTheme);public class MyDialog extends AlertDialog { private Context context; private Bu......

AlertDialog You need to use a Theme.AppCompat theme (or descendant) with this activity.

 

解决方案:

 

将:super(context);修改为 super(context,R.style.AppTheme); 

public class MyDialog
        extends AlertDialog
 
{
    private Context context;
    private Button ivConfirm, ivCancel;
    private ImageView popCancel;
    private TextView tvMessage;

    public MyDialog(@NonNull Context context) {
        super(context,R.style.AppTheme);
        this.context = context;
    }

}

 

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

 

 

本文地址:https://blog.csdn.net/happyhell/article/details/107977986

相关标签: Android