2015-10-12 24 views
12

Styles.xmlファイルにいくつかの項目を追加しています。しかし、それは私にエラーを与えています。指定された名前を持つリソースが見つかりませんTheme.AppCompat.Light.NoActionBar

ここに私のコードです。

<?xml version="1.0" encoding="UTF-8" ?> 
<resources> 
    <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="colorPrimary">#2196F3</item> 
     <item name="drawerArrowStyle">@style/MyDrawerArrowStyle</item> 
    </style> 
    <style name="MyDrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> 
     <item name="color">#F5F5F5</item> 
     <item name="spinBars">true</item> 
    </style> 
</resources> 

エラーは、アイテムの親を取得

error screenshot

  1. エラー下のスクリーンショットで見ることができます:いいえリソースそれは与えられた名前と一致した「Theme.AppCompat.Light.NoActionBar」。
  2. 指定された名前と一致するリソースが見つかりませんでした:attr 'colorPrimary'。
  3. 指定された名前と一致するリソースが見つかりませんでした:attr 'drawerArrowStyle'。 4.指定された名前「Widget.AppCompat.DrawerArrowToggle」と一致するリソースが見つかりません。
  4. 指定された名前と一致するリソースが見つかりませんでした:attr 'color'。
  5. 指定された名前と一致するリソースが見つかりませんでした:attr 'spinBars'。

答えて

0

最初にTheme.AppCompat.Light.NoActionBarが存在するかどうかはわかりません。

あなたは、代わりにこのような何かを行うことができます:

<style name="MyTheme" parent="Theme.AppCompat.Light"> 
    <item name="colorPrimary">#2196F3</item> 
    <item name="drawerArrowStyle">@style/MyDrawerArrowStyle</item> 
    <item name="windowActionBar">false</item> 
    <item name="android:windowNoTitle">true</item> 
</style> 
+0

ありがとうCheesebaron – Bikash

0

は、これらの問題を解決するための手順です。 1)AndroidManifest.xmlに移動し、uses-sdkタグの下にandroid:targetSdkVersionを23に追加します。 2)Project - > Generalに移動して、Target frameworkをAndroid 6.0(Marshmallow)に設定します。 3)Project - > Android Application - > Android AndroidバージョンをAndroid 6.0に設定します。

Androidバージョン7.0は最新のXamarin Studioでコンパイルされていません。現在、AndroidプロジェクトはAndroid 6.0までしかコンパイルできません。

+0

これはもうこれ以上ないと思います。 – shortstuffsushi

0
add component Support Library v7 AppCompat 

create values/styles and add 
<?xml version="1.0" encoding="utf-8" ?> 
<resources> 

    <style name="MyTheme" parent="MyTheme.Base"> 
    </style> 
    <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:--> 
    <item name="windowNoTitle">true</item> 
    <!--We will be using the toolbar so no need to show ActionBar--> 
    <item name="windowActionBar">false</item> 
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette--> 
    <!-- colorPrimary is used for the default action bar background --> 
    <item name="colorPrimary">#2196F3</item> 
    <!-- colorPrimaryDark is used for the status bar --> 
    <item name="colorPrimaryDark">#1976D2</item> 
    <!-- colorAccent is used as the default value for colorControlActivated 
     which is used to tint widgets --> 
    <item name="colorAccent">#FF4081</item> 
    <!-- You can also set colorControlNormal, colorControlActivated 
     colorControlHighlight and colorSwitchThumbNormal. --> 
    </style> 
</resources> 

add another folder values-v21 
create styles.xml and add 
<?xml version="1.0" encoding="utf-8" ?> 
<resources> 
    <!-- 
     Base application theme for API 21+. This theme replaces 
     MyTheme from resources/values/styles.xml on API 21+ devices. 
    --> 
    <style name="MyTheme" parent="MyTheme.Base"> 
    <item name="android:windowContentTransitions">true</item> 
    <item name="android:windowAllowEnterTransitionOverlap">true</item> 
    <item name="android:windowAllowReturnTransitionOverlap">true</item> 
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> 
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item> 
    </style> 
</resources> 
関連する問題