android - 5dp 的 'padding' 处不允许使用整数类型

标签 android xml eclipse android-layout

我有一个我写的项目,当我完成它时,代码运行良好,没有错误。 有一天,我打开 Eclipse,发现三个错误,我的布局中有三分之一错误。

两种情况:

Error Integer Type not allowed at 'padding'

这个错误是针对代码的:

<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" >        # line the error is on

以上在两种不同的布局中是相同的,下面的代码是第三种:

<TextView
    android:id="@+id/finalBillTextView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"     #line the error is on
    android:layout_span="2"
    android:layout_weight="1"
    android:text="@string/total_bill_TV" />

错误为:

Error parsing XML: duplicate attribute

我不明白我做错了什么。代码中使用“5dp”或类似内容的任何其他地方都可以。如果删除代码并重新输入错误全部消失,并且在我重新加载 eclipse 之前不会返回。

我已经尝试在 values 文件夹中的 dimens.xml 文件中创建值并使用 @dimen/引用它,但这没有用,我根本不理解 duplacate 值。这可能是 eclipse 错误吗?

最佳答案

如果拼写错误部分没有修复它(只是在上面输入错误),那么如果您使用的是 Eclipse,有时执行“清理项目”可以清除错误。

关于android - 5dp 的 'padding' 处不允许使用整数类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17824152/

相关文章:

android - 即使我删除了 onMessageReceived(),我如何收到来自 Firebase 的通知

android - Activity 在 Intent 中找不到 Bundle

java - 找不到 OSGi 包的 Activator 类

java - jaxb意外元素错误本地:root

python xml删除孙子或孙子

java - Eclipse 调试 - 行 : not available

eclipse - 如何在 Eclipse 中设置匿名书签?

java - Android:有什么方法可以精确区分Phone-Movement和-Rotation吗?

android - 在 PhoneGap 中的 Android 后退按钮上停止退出 - 构建

java - 将字符串解析为 XML 文档 jdom2