title: Styling composite views
body: <p>I want to create a composite item and have different styles for it, but I don't see how to achieve it so far with a single style, I have to use different styles.</p>
  
  <p>To illustrate my issue, I will define a sample scenario. Imagine I have a list with items, this items are users and I have an avatar, a username and an email. I want to style each of those 3 differenty deppending on my Theme.</p>
  
  <p><strong>What I am trying to achieve:</strong></p>
  
  <p>(file res/layout/item_user.xml, this will be inflated for a ListView)</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="wrap_content"
      style="@style/CustomStyleA"&gt;
  
      &lt;ImageView
          style="avatarStyle"
          android:id="@+id/avatar"
          android:src="@drawable/avatar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          style="usernameStyle"
          android:id="@+id/username"
          android:text="Username"
          android:layout_toRightOf="@id/avatar"
          android:layout_alignParentTop="true"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          style="emailStyle"
          android:id="@+id/email"
          android:text="fakemail@mail.com"
          android:layout_toRightOf="@id/avatar"
          android:layout_below="@id/username"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>(file res/values/styles.xml)</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Style A --&gt;
      &lt;style name="CustomStyleA"&gt;
          &lt;item name="avatarStyle"&gt;@style/CustomStyleA.Avatar&lt;/item&gt;
          &lt;item name="usernameStyle"&gt;@style/CustomStyleA.Username&lt;/item&gt;
          &lt;item name="emailStyle"&gt;@style/CustomStyleA.Email&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleA.Avatar"&gt;
          &lt;!-- Here avatar specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleA.Username" parent="android:TextAppearance"&gt;
          &lt;!-- Here username specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleA.Email" parent="android:TextAppearance"&gt;
          &lt;!-- Here email specific styles --&gt;
      &lt;/style&gt;
  
      &lt;!-- Style B --&gt;
      &lt;style name="CustomStyleB"&gt;
          &lt;item name="avatarStyle"&gt;@style/CustomStyleB.Avatar&lt;/item&gt;
          &lt;item name="usernameStyle"&gt;@style/CustomStyleB.Username&lt;/item&gt;
          &lt;item name="emailStyle"&gt;@style/CustomStyleB.Email&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleB.Avatar"&gt;
          &lt;!-- Here avatar specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleB.Username" parent="android:TextAppearance"&gt;
          &lt;!-- Here username specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleB.Email" parent="android:TextAppearance"&gt;
          &lt;!-- Here email specific styles --&gt;
      &lt;/style&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p><strong>What I actually have to do</strong></p>
  
  <p>(file res/layout/item_user.xml, this will be inflated for a ListView)</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="wrap_content"&gt;
  
      &lt;ImageView
          style="@style/CustomStyleA.Avatar"
          android:id="@+id/avatar"
          android:src="@drawable/avatar"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          style="@style/CustomStyleA.Email"
          android:id="@+id/username"
          android:text="Username"
          android:layout_toRightOf="@id/avatar"
          android:layout_alignParentTop="true"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
      &lt;TextView
          style="@style/CustomStyleA.Email"
          android:id="@+id/email"
          android:text="fakemail@mail.com"
          android:layout_toRightOf="@id/avatar"
          android:layout_below="@id/username"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>(file res/values/styles.xml)</p>
  
  <pre><code>&lt;resources&gt;
  
      &lt;!-- Style A --&gt;
  
      &lt;style name="CustomStyleA.Avatar"&gt;
          &lt;!-- Here avatar specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleA.Username" parent="android:TextAppearance"&gt;
          &lt;!-- Here username specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleA.Email" parent="android:TextAppearance"&gt;
          &lt;!-- Here email specific styles --&gt;
      &lt;/style&gt;
  
      &lt;!-- Style B --&gt;
  
      &lt;style name="CustomStyleB.Avatar"&gt;
          &lt;!-- Here avatar specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleB.Username" parent="android:TextAppearance"&gt;
          &lt;!-- Here username specific styles --&gt;
      &lt;/style&gt;
  
      &lt;style name="CustomStyleB.Email" parent="android:TextAppearance"&gt;
          &lt;!-- Here email specific styles --&gt;
      &lt;/style&gt;
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>As you can see, the second scenario implies that if I want to change the whole style of the item, I have to do it individually for each view. I would like to change only the top style.</p>