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

前端 未结 30 4001
感动是毒
感动是毒 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:05

    I had this problem as well and what I did to fix it, AND still use the Holo theme was to take these steps:

    first I replaced this import:

    import android.support.v7.app.AppCompatActivity;
    

    with this one:

    import android.app.Activity;
    

    then changed my extension from:

    public class MyClass extends AppCompatActivity {//...
    

    to this:

    public class MyClass extends Activity {//...
    

    And also had to change this import:

    import android.support.v7.app.AlertDialog;
    

    to this import:

    import android.app.AlertDialog;
    

    and then you can use your theme tag in the manifest at the activity level:

    android:theme="@android:style/Theme.Holo.Dialog" />
    

    and lastly, (unless you have other classes in your project that has to use v7 appCompat) you can either clean and rebuild your project or delete this entry in the gradle build file at the app level:

    compile 'com.android.support:appcompat-v7:23.2.1'
    

    if you have other classes in your project that has to use v7 appCompat then just clean and rebuild the project.

提交回复
热议问题