繁体   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