title: Android Textview background color resource
body: <p>I have a <code>listView</code>. custom_listitem1.xml is used for the items display in the list. Now i want to set <code>Selector</code> based color resource(list_selector_color.xml) for the background of the item.</p>
  
  <p><strong>custom_listitem1.xml</strong></p>
  
  <pre><code>&lt;TextView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@android:id/text1"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#000000"
      android:textSize="18sp"
      android:textStyle="bold"
      android:background="@color/list_selector_color"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:gravity="center_vertical"
      android:paddingLeft="6dip"
      android:minHeight="?android:attr/listPreferredItemHeight"/&gt;
  </code></pre>
  
  <p><strong>list_selector_color.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;item android:state_pressed="true"
            android:color="#ffff0000"/&gt; &lt;!-- pressed --&gt;
      &lt;item android:state_focused="true"
            android:color="#ff0000ff"/&gt; &lt;!-- focused --&gt;
      &lt;item android:color="#ff000000"/&gt; &lt;!-- default --&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>but it is giving following errors.....</p>
  
  <pre><code>06-06 18:38:19.422: ERROR/AndroidRuntime(18603): Uncaught handler: thread main exiting due to uncaught exception
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603): android.view.InflateException: Binary XML file line #1: Error inflating class &lt;unknown&gt;
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.ResourceCursorAdapter.newView(ResourceCursorAdapter.java:79)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.SimpleCursorAdapter.newView(SimpleCursorAdapter.java:96)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.CursorAdapter.getView(CursorAdapter.java:182)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.AbsListView.obtainView(AbsListView.java:1274)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.ListView.makeAndAddView(ListView.java:1668)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.ListView.fillDown(ListView.java:637)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.ListView.fillFromTop(ListView.java:694)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.ListView.layoutChildren(ListView.java:1521)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.AbsListView.onLayout(AbsListView.java:1113)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1108)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.onLayout(LinearLayout.java:920)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1119)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:998)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.LinearLayout.onLayout(LinearLayout.java:918)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.FrameLayout.onLayout(FrameLayout.java:333)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.layout(View.java:6830)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.ViewRoot.performTraversals(ViewRoot.java:996)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.os.Handler.dispatchMessage(Handler.java:99)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.os.Looper.loop(Looper.java:123)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at java.lang.reflect.Method.invokeNative(Native Method)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at java.lang.reflect.Method.invoke(Method.java:521)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at dalvik.system.NativeStart.main(Native Method)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603): Caused by: java.lang.reflect.InvocationTargetException
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.TextView.&lt;init&gt;(TextView.java:329)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at java.lang.reflect.Constructor.constructNative(Native Method)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.LayoutInflater.createView(LayoutInflater.java:500)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     ... 52 more
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603): Caused by: android.content.res.Resources$NotFoundException: File res/color/list_selector_color.xml from drawable resource ID #0x7f070000
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.content.res.Resources.loadDrawable(Resources.java:1693)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.view.View.&lt;init&gt;(View.java:1850)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     at android.widget.TextView.&lt;init&gt;(TextView.java:335)
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603):     ... 56 more
  06-06 18:38:19.445: ERROR/AndroidRuntime(18603): Caused by: org.xmlpul
  </code></pre>
  
  <p>what is the problem in my code?</p>