Can't load custom attributes in XML
<p>I tried to follow <a href="http://kevindion.com/2011/01/custom-xml-attributes-for-android-widgets/" rel="nofollow">this guide</a> and <a href="http://stackoverflow.com/questions/2029719/how-can-i-create-my-custom-properties-on-xml-for-android">this post</a> on how to make custom attributes for the layout XML of a custom View, however no matter what I do, I get back a list of zero custom attributes, and I am having a lot of trouble figuring out how to debug this.</p>

<p>I made a file res/values/attrs.xml like so:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;resources&gt;
    &lt;declare-styleable name="TexturedListView"&gt;
        &lt;attr name="backgroundTexture" format="reference"/&gt;
    &lt;/declare-styleable&gt;
&lt;/resources&gt;
</code></pre>

<p>I then created a custom view within a layout XML file like so:</p>

<pre><code>&lt;RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="https://schemas.android.com/apk/res/xxx.rtin.texturedlistview"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" &gt;
    &lt;xxx.rtin.texturedlistview.TexturedListView
        android:id="@+id/texturedListView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:dividerHeight="10dp"
        android:padding="20dp"
        custom:backgroundTexture="@drawable/background" &gt;
    &lt;/xxx.rtin.texturedlistview.TexturedListView&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>Then from within the constructor of my TexturedListView class, I call the following attempting to read this custom attribute:</p>

<pre><code>public TexturedListView(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(R.styleable.TexturedListView);

    final int N = a.getIndexCount();
    //..snip...
}
</code></pre>

<p>Without fail, however, N is 0. R.styleable.TexturedListView seems to have proper ID in it, and I've tried cleaning and rebuilding my project, but to no avail. I feel like I have to be missing something subtle, but I can't figure it out.</p>

<p>What am I doing wrong? How do I read these custom attributes?</p>
