簡體   English   中英

錯誤:不允許使用字符串類型(值“失敗”時)@ values / values.xml

[英]Error: String types not allowed (at 'fail' with value) @values/values.xml

我正在使用我的應用程序的Twitter帳戶創建一個登錄頁面。 當我構建我的項目時,就會發生上述錯誤。

values / strings.xml

<style name="Base.TextAppearance.AppCompat.Medium">
    <item name="android:textSize">@dimen/abc_text_size_medium_material</item>
    <item name="android:textColor">?android:attr/textColorSecondary</item>
</style>

values/strings.xml

路徑錯誤。請將其放在樣式部分。

在XML資源中定義了一種樣式,該樣式與指定布局的XML分開。 此XML文件位於項目的res / values /目錄下,並將作為樣式文件所必需的根節點。

http://www.tutorialspoint.com/android/android_styles_and_themes.htm

這是values / string.xml

<string name="activity_name">Home</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>

這是values / style.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="toolbarStyle">@style/Custom.Widget.Toolbar</item>
</style>

兩者都是不同的東西

我得到此錯誤並通過這種方式解決:問題是style.xml文件中的某些樣式項沒有任何值,如下所示; 只需評論或刪除該行: 這沒什么

暫無
暫無

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

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