2017-05-26 37 views
0

values.xml URI is not Registered了錯誤登記,並建立失敗,原因是URI不values.xml

Error:(729, 21) No resource found that matches the given name: attr 'listTextColor'.

Error:(728, 21) No resource found that matches the given name: attr 'colorMain'.

Error:(728, 21) No resource found that matches the given name: attr 'colorMain'.

Error:(729, 21) No resource found that matches the given name: attr 'listTextColor'.

Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: Failed to execute aapt

但我在colors.xml

編輯 colors.xml有colorMainlistTextColor

<color name="colorMain">#fff</color> <color name="listTextColor">#fff</color>

I U SED在這裏:

`<EditText 
       android:id="@+id/edittxtPassword" 
       android:layout_width="match_parent" 
       android:layout_height="45dp" 
       android:background="@color/listTextColor" 
       android:hint="Enter your Password" 
       android:inputType="number" 
       android:maxLength="10" 
       android:paddingBottom="5dp" 
       android:paddingLeft="45dp" 
       android:paddingRight="5dp" 
       android:paddingTop="5dp" />` 
+0

粘貼如何在colors.xml中定義colorMain和listTextColor – santak

+0

您可以粘貼colors.xml嗎?你在哪裏提到顏色? –

+0

@santak請參閱編輯 – Bullet

回答

1

的問題是存在的colorMainlistTextcolor條目在styles.xml中

然後我刪除了條目,然後重建。建立成功。

2

創建res目錄「彩色」的文件夾,添加顏色資源文件,並在顏色XML文件中定義這樣的顏色

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:color="@android:color/black" /> 
    <item android:color="@android:color/white" /> 
</selector>