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

相关文章
相关标签/搜索