2017-02-25 31 views
0

有人可以在android studio上向我解释这个错误吗?错误:(25,28)找不到与给定名称相匹配的资源(在'主题'中使用'@ style/AppTheme.NoActionBar'值)

Error:(25, 28) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.NoActionBar'). Error:(25, 28) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.NoActionBar').

这是我manifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="foo" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="15" 
     android:targetSdkVersion="25" /> 

    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.SET_WALLPAPER" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" > 

     <!-- all the activities goes here --> 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme.NoActionBar" > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

,这是我styles.xml文件:

<resources> 

    <style name="FreeWallTheme" parent="@android:style/Theme.Holo.Light"> 
     <item name="android:actionBarStyle">@style/MyActionBarTheme</item> 

    </style> 

    <style name="MyActionBarTheme" parent="@android:style/Widget.Holo.Light.ActionBar"> 
     <item name="android:background">@color/action_bar</item> 
     <item name="android:titleTextStyle">@style/TitleTextStyle</item> 
    </style> 

    <style name="TitleTextStyle" parent="android:TextAppearance.Holo.Widget.ActionBar.Title"> 
     <item name="android:textColor">@color/action_bar_title</item> 
    </style> 

</resources> 

在此先感谢。

回答

1

让这改变

<application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 

     android:supportsRtl="true" > 

     <!-- all the activities goes here --> 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" 
      android:theme="@style/AppTheme" 
      > 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

和风格

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/btn_background_green</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 
+0

感谢您的回答添加,你可以更清楚了吗? – OiRc

+0

此解决方案不起作用 – OiRc

+0

只需在style.xml文件中添加AppTheme样式,并用您的代码替换

相关问题