You need to use a Theme.AppCompat theme (or descendant) with this activity. Change to Theme.AppCompat causes other error

前端 未结 14 933
Happy的楠姐
Happy的楠姐 2020-11-27 15:47

I use appcompat v22.1.0 in my App and use Toolbar. Everything was fine when I use Theme.AppCompat.Light.NoActionBar. When I start implement AlertDialog

14条回答
  •  迷失自我
    2020-11-27 16:24

    if you have this error when you creating a dialog (just in my case) you should use the following:

    AlertDialog.Builder dialog = new AlertDialog.Builder(context, R.style.Theme_AppCompat_Light);
    

    instead of:

    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    

    This worked me perfectly!

提交回复
热议问题