在我的Android項目中,我有幾個使用自定義屬性的自定義組件。自定義屬性錯誤 - Android Studio 1.2
的attrs.xml文件看起來是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<resources >
<declare-styleable name = "TextBox">
<attr name = "font" format = "string"/>
</declare-styleable>
<declare-styleable name = "ButtonBox">
<attr name = "font" format = "string"/>
</declare-styleable>
</resources>
我拉在屬性只是在自定義組件很好,但是當我去跑我看到下面的錯誤代碼。
Error: Found item Attr/font more than one time
Error: Execution failed for task ':app:mergeDebugResources'.
它應該沒有區別,兩個不同的聲明樣式資源中有相似的屬性名稱是正確的嗎?
如果您有任何幫助,將不勝感激,謝謝!
類似http://stackoverflow.com/questions/4434327/same-named-屬性在attrs xml爲自定義視圖 – Suragch