简体   繁体   English

Android string.xml和style.xml解析错误

[英]Android string.xml and style.xml parsing error

 <style name="ButtonText">
    <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#ffffff</item>
        <item name="android:gravity">center</item>
        <item name="android:layout_margin">3dp</item>
        <item name="android:textSize">30sp</item> 
        <item name="android:textStyle">bold</item>
        <item name="android:shadowColor">#000000</item>
        <item name="android:shadowDx">1</item>
        <item name="android:shadowDy">1</item>
        <item name="android:shadowRadius">2</item>
  </style>

I am getting this weird error saying 'Originally posted here' on line 我收到这个奇怪的错误,说“原来在这里发布”

<item name="android:textSize">30sp</item> in my xml file. 我的xml文件中的<item name="android:textSize">30sp</item> I am using android 2.3. 我正在使用android 2.3。

I am also getting error in style.xml 我在style.xml中也遇到错误

 <style name="ButtonText" parent="BaseTopBar">
        <item name="android:textSize">14dp</item>
 </style>

The error is 'Resource entry ButtonText already has bag item android:textSize' 错误是“资源条目ButtonText已经具有袋子项android:textSize”

Can someone help please. 有人可以帮忙吗。

it seems like everything is right in your string.xml file You just need to clean and build your project. 似乎一切都正确在您的string.xml文件中,您只需要清理并构建您的项目即可。

if it doesn't work delete the bin/ and gen/ directory from your project than clean build your project. 如果不起作用,则从项目中删除bin /和gen /目录,而不是干净地构建项目。

and the error will not be shown anymore.hope it will help. 该错误将不再显示。希望它会有所帮助。

I had a similar issue but when using multiple array lists in my strings.xml. 我有一个类似的问题,但是在我的strings.xml中使用多个数组列表时。

在此处输入图片说明

It turned out that I had duplicate names for the arrays where I'd copied and pasted values. 原来,对于复制和粘贴值的数组,我有重复的名称。

Check that the style name ButtonText isn't duplicated somewhere else. 检查样式名称ButtonText是否在其他地方没有重复。 You should have a corresponding error like the image below: 您应该有一个对应的错误,如下图所示:

在此处输入图片说明

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

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