0

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')
4

1 に答える 1

2

@ colors / blankではなく、@ color/blankです。's'はありません:)

于 2010-08-19T01:33:25.820 に答える