簡體   English   中英

在android中的Style.xml上出錯

[英]Getting error on Style.xml in android

我的問題是,我在收到錯誤styles.xml在我的Android project.May是由於我的R.java沒有generating.I正在使用支持庫appcompact_V7支持庫。 任何人都可以指定我在我的程序中犯了什么錯誤。 這是我的代碼....

樣式文件

 <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>

我的 android 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 ,那么只需從每個 xml 文件的 res/menu 文件夾中刪除android:showAsAction="never"

在我們的style.xml更改第一個樣式標簽如下:

<style name="AppBaseTheme" parent="android:Theme.Light">

我收到無法解析符號“Theme.AppCompat.Light”的錯誤

我不確定你是否有同樣的問題。 這個方法解決了我的問題。

  1. 轉到您的項目目錄(或項目視圖)
  2. 查找並打開 .idea 目錄
  3. 刪除緩存和庫目錄 <-- 這是必不可少的
  4. 使緩存無效/重新啟動

參考: https : //github.com/red5pro/streaming-android/issues/31

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM