To define a reference attribute you must declare
<declare-styleable name="Title">
<attr name="textTitle" format="reference" />
<attr name="textSubtitle" format="reference" />
<attr name="textBody" format="reference" />
</declare-styleable>
And to create your TextView
<com.tuapp.Title
android:id="@+id/title"
custom:textTitle="@color/my_color1"
custom:textSubtitle="@color/my_color2"
custom:textBody = "@color/my_color3"
..... />
EDITING
Well, as you know the attributes with format="reference"
are as their name says "refer" to different types of <style>
or layouts
already defined, in the question that you leave the user says that you believe the attr
(as I leave it to you). Then in the file define <style>
style.xml
<style name="small_title_text">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/green</item>
<item name="android:textStyle">normal</item>
<item name="android:paddingBottom">5dip</item>
</style>
And then in this same file define
<style name="Theme.Small">
<item name="textTitle">@style/small_title_text</item>
<item name="textBody">@style/small_body_text</item>
</style>
Where it says that for <style>
Theme.Small
there is an item which is called textTitle
(which is the attr you created) and gives @style/small_title_text
which is the reference as it is created in attr.xml
The error you have is that you created the attr
but not the reference to which you will obey.
<TextView
android:id="@+id/title"
style="?textTitle" //<---- Hace referencia al Item y no al attr como piensas
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Select the size of the text"
/>