android - 在 android 中获取关于 Style.xml 的错误

标签 android xml android-manifest

我的问题是我的 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/

相关文章:

android - 将动画从位置 Y 平移到屏幕顶部

xml - 从 NSXMLDocument 获取值

android - 从应用程序最小化状态启动主 Activity

Android Studio 在真实设备上运行应用程序后添加了不需要的权限

java - HttpURLConnection 将响应返回为 FileNotFoundException (404) 而不是 401

android - JNI 多个注册调用

android - Eclipse 中的 INSTALL_PARSE_FAILED_NO_CERTIFICATES 错误

java - 为 View 禁用 onClick 声音

c# - 使用来自 XML 文件的单独元素

google-play - 我的应用程序不支持任何设备