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

啓動一直提示這個錯誤
You need to use a Theme.AppCompat theme (or descendant) with this activity.android

若是想處理這個有2種方案this

1.修改的Activity 的 extends 修改成 Activity 這樣就不會保存xml

2.若是須要強制 繼承 沒個類  例如AppCompatActivity用來掃描繼承

打開AndroidManifest.xml,給Test2Activity的節點指定Theme.AppCompat相關的風格it

好比先在styles.xml中聲明風格:
    <style name="AppCompatTheme" parent="Theme.AppCompat.Light.NoActionBar">
    </style>
而後在AndroidManifest.xml對activity節點補充android:theme屬性:
        <activity android:name=".Test2Activity" android:theme="@style/AppCompatTheme" />io

相關文章
相關標籤/搜索