2017-02-25 30 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樣式,並用您的代碼替換

相關問題