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

前端 未结 30 4136
感动是毒
感动是毒 2020-11-21 04:42

Android Studio 0.4.5

Android documentation for creating custom dialog boxes: http://developer.android.com/guide/topics/ui/dialogs.html

If you want a custom d

30条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-21 05:02

    The reason you are having this problem is because the activity you are trying to apply the dialog theme to is extending ActionBarActivity which requires the AppCompat theme to be applied.

    Update: Extending AppCompatActivity would also have this problem

    In this case, change the Java inheritance from ActionBarActivity to Activity and leave the dialog theme in the manifest as it is, a non Theme.AppCompat value


    The general rule is that if you want your code to support older versions of Android, it should have the AppCompat theme and the java code should extend AppCompatActivity. If you have *an activity that doesn't need this support, such as you only care about the latest versions and features of Android, you can apply any theme to it but the java code must extend plain old Activity.


    NOTE: When change from AppCompatActivity (or a subclass, ActionBarActivity), to Activity, must also change the various calls with "support" to the corresponding call without "support". So, instead of getSupportFragmentManager, call getFragmentManager.

提交回复
热议问题