我的问题是我的 android 项目中的 styles.xml
出现错误。可能是因为我的 R.java
没有生成。我正在使用支持库 appcompact_V7
支持库。任何人都可以指定我在我的程序中犯了什么错误。这是我的代码....
样式.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
{ AT THE BELOW LINE I AM GETTING THE ERROR}
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
我的安卓manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bq.sample"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.AppCompat.Light" >
<activity
android:name=".Image"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
最佳答案
您只需将样式更改为
<style name="AppBaseTheme" parent="android:Theme.Light">
而不是
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
如果您仍然面临类似 No resource identifier found for attribute 'showAsAction' in package
的错误, 然后删除 android:showAsAction="never"
来自每个 xml 文件的 res/menu 文件夹。
关于android - 在 android 中获取关于 Style.xml 的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27631769/