我有一个我写的项目,当我完成它时,代码运行良好,没有错误。 有一天,我打开 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/