Android例外:此活动需要使用Theme.AppCompat主题
为了使用支持操作栏,我的活动必须扩展ActionBarActivity,当我这样做并启动活动时,应用程序会崩溃: 例外:此活动需要使用Theme.AppCompat主题(或子代) 在my styles.xml中,我有Android例外:此活动需要使用Theme.AppCompat主题,android,Android,为了使用支持操作栏,我的活动必须扩展ActionBarActivity,当我这样做并启动活动时,应用程序会崩溃: 例外:此活动需要使用Theme.AppCompat主题(或子代) 在my styles.xml中,我有 <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light"></style> 并在我的AndroidManifest.xml中查找我的违规活动 <activity androi
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light"></style>
并在我的AndroidManifest.xml中查找我的违规活动
<activity android:name="com.example.test3.SettingsActivity"
android:theme="@style/AppBaseTheme" />
您必须检查是否有其他文件夹也包含样式文件,这些文件夹可能会覆盖您的样式 吴宗武说:
<style name="Theme.Event" parent="Theme.AppCompat">
然后在AndroidManifest.xml中设置主题:
<application
android:debuggable="true"
android:name=".activity.MyApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Event.Home">
在清单文件中写下这一行
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
样本:
<activity
android:name="com.vmoksha.BaseActivity"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
并将此代码添加到资源标记内的styles.xml中
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
</style>
真的
干杯 你还有其他价值观吗?比如v11之类的?啊,就是这样。请把它写下来作为一个答案,这样我可以标记它,它也可以帮助其他人。