简体   繁体   English

错误:不允许使用字符串类型(值“失败”时)@ values / values.xml

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

I am create a login page with twitter account for my app. 我正在使用我的应用程序的Twitter帐户创建一个登录页面。 And the above error is occur when i build my project. 当我构建我的项目时,就会发生上述错误。

values/strings.xml 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>

Don't

values/strings.xml

Wrong path .Put this on your style section . 路径错误。请将其放在样式部分。

A style is defined in an XML resource that is separate from the XML that specifies the layout. 在XML资源中定义了一种样式,该样式与指定布局的XML分开。 This XML file resides under res/values/ directory of your project and will have as the root node which is mandatory for the style file. 此XML文件位于项目的res / values /目录下,并将作为样式文件所必需的根节点。

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

THIS is values/string.xml 这是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>

THIS is values/style.xml 这是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>

Both are different things 两者都是不同的东西

I have get this error and fix it by this way: problem was some style items in style.xml file that does not have any value, something like below; 我得到此错误并通过这种方式解决:问题是style.xml文件中的某些样式项没有任何值,如下所示; just comment or remove that line: here is not anything 只需评论或删除该行: 这没什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM