在values / colors.xml中,我把:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<color name="blank">#f0f0f0</color>
</resources>
在layout / main.xml中,我把:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@colors/blank"
/>
</LinearLayout>
我收到了错误:
No resource found that matches the given name (at 'textColor' with value '@colors/blank')
答案 0 :(得分:2)
它是@ color / blank,而不是@ colors / blank。没有's':)