2015-10-12 27 views
12

Bazı öğeleri Styles.xml dosyalarına ekliyorum. Ancak, bana bir hata veriyor. Belirtilen adın işlenmediği kaynak bulunamadı Theme.AppCompat.Light.NoActionBar

İşte benim kodudur.

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

Hata öğesi için ebeveyn alınırken

error screenshot

  1. Hata Aşağıdaki ekran görüntüsünde görülebilir: Hayır kaynak adı verilen maçları bulundu 'Theme.AppCompat.Light.NoActionBar'.
  2. Belirtilen adla eşleşen kaynak bulunamadı: attr 'colorPrimary'.
  3. Belirtilen adla eşleşen kaynak bulunamadı: attr 'drawerArrowStyle'. 4. .No kaynak belirtilen 'Widget.AppCompat.DrawerArrowToggle' adıyla eşleşen bulundu.
  4. Belirtilen adla eşleşen kaynak bulunamadı: attr 'color'.
  5. Belirtilen adla eşleşen kaynak bulunamadı: attr 'spinBars'.

cevap

0

Theme.AppCompat.Light.NoActionBar'un ilk sırada olup olmadığını hatırlayamıyorum.

Sen artık şöyle bir şey yapabilirsiniz:

<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

Teşekkür ederim Cheesebaron – Bikash

0

Bağlantı = bu sorunları çözmek için adımlar. 1) AndroidManifest.xml adresine gidin ve android: targetSdkVersion öğesini use-sdk etiketi altında 23'e ekleyin. 2) Project -> General'e gidin ve Android 6.0'a (Marshmallow) Hedef çerçeveyi ayarlayın. 3) Project -> Android Uygulaması -> Hedef Android sürümünü Android 6.0'a getirin.

Android sürüm 7.0, en son Xamarin Studio.Right'da derlenmiyor, artık Android projesini Android 6.0'a kadar derleyebilirsiniz.

+0

Artık bunun böyle olduğunu sanmıyorum. – 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> 
İlgili konular