title: Overriding referenced style attributes
body: <p>After reading through <a href="http://developer.android.com/guide/topics/resources/accessing-resources.html#ReferencesToThemeAttributes" rel="noreferrer">References To Theme Attributes</a> I am trying to reference the value of an attribute in the my custom theme that I have set.</p>
  <p>I am applying a user-defined style to a <code>CheckedTextView</code></p>
  <pre><code>&lt;CheckedTextView
      android:id=&quot;@+id/contactInfo&quot;
      style=&quot;@style/ListViewCheckedTextViewRowStyle&quot; &gt;
  &lt;/CheckedTextView&gt;
  </code></pre>
  <p>The user-defined style is defined as :</p>
  <pre><code>&lt;style name=&quot;ListViewCheckedTextViewRowStyle&quot; parent=&quot;@style/ListViewRowStyle&quot;&gt;
      &lt;item name=&quot;android:checkMark&quot;&gt;?android:listChoiceIndicatorMultiple&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  <p>My theme I created is defined as :</p>
  <pre><code>&lt;style name=&quot;Theme.Yellowgreen&quot; parent=&quot;android:Theme.Holo.Light.DarkActionBar&quot;&gt;
      &lt;item name=&quot;android:listChoiceIndicatorMultiple&quot;&gt;@drawable/btn_check_holo_light&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  <p>However, the checkMark styling that gets displayed is the device's default theme's drawable and not my user defined drawable.</p>
  <p>The only way I can have my drawable displayed is with :</p>
  <pre><code>&lt;style name=&quot;ListViewCheckedTextViewRowStyle&quot; parent=&quot;@style/ListViewRowStyle&quot;&gt;
      &lt;item name=&quot;android:checkMark&quot;&gt;@drawable/btn_check_holo_light&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  <p>But that defeats the whole purpose of overriding this attribute, especially since I would like to override this attribute in multiple themes.</p>
  <p>I am setting the theme in the <code>onCreate()</code> method of my <code>Activity</code> like this:</p>
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      this.setTheme(R.style.Theme_Yellowgreen);
      super.onCreate(savedInstanceState);
      // ...
  }
  </code></pre>
  <p>I also tried to set the theme in the AndroidManifest.xml file like :</p>
  <pre><code>&lt;application android:theme=&quot;@style/Theme.Yellowgreen&quot; &gt;
  </code></pre>
  <p>But that didn't work.  What could be going wrong?</p>
  <h1>Update</h1>
  <p>I just created a small sample project and it looks like the code i posted above is working.  So i must have some other styles which are overriding this property or perhaps it has to do with my layout xml files.</p>
  <p>In my large project, I have two <code>Fragments</code> within an <code>Activity</code>.  Both <code>Fragments</code> have <code>Listviews</code> backed by <code>Adapters</code>.  In <code>Fragment A</code> the <code>getView()</code> method of the <code>Adapter</code> is as follows:</p>
  <pre><code>public View getView(final int position, View convertView, ViewGroup parent) {
      if (convertView == null) {
          convertView = mInflater.inflate(R.layout.contact_entry, null);
      }
  
      //...
  
      return convertView;
  }
  </code></pre>
  <p>In <code>Fragment B</code> the <code>getView()</code> method of the <code>Adapter</code> is as follows:</p>
  <pre><code>public View getView(final int position, View convertView, ViewGroup parent) {
      if (convertView == null) {
          convertView = mInflater.inflate(R.layout.list_item, parent, false);
      }
  
      //...
  
      return convertView;
  }
  </code></pre>
  <p>The layouts are defined as follows:</p>
  <p><strong>list_item.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:id=&quot;@+id/list_item&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:orientation=&quot;vertical&quot;&gt;
      
      &lt;include layout=&quot;@layout/list_item_header&quot; /&gt;
      
      &lt;include layout=&quot;@layout/contact_entry&quot; /&gt;
  
      &lt;View android:id=&quot;@+id/list_divider&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;1dp&quot;
          android:background=&quot;@android:drawable/divider_horizontal_dark&quot; /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p><strong>list_item_header.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;TextView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:id=&quot;@+id/header_text&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;25dip&quot;
      android:background=&quot;@color/dark_blue&quot;
      android:gravity=&quot;center_vertical&quot;
      android:paddingLeft=&quot;6dip&quot;
      android:textColor=&quot;@color/white&quot;
      android:textSize=&quot;14sp&quot;
      android:textStyle=&quot;bold&quot; /&gt;
  </code></pre>
  <p><strong>contact_entry.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:id=&quot;@+id/contactEntry&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:minHeight=&quot;?android:attr/listPreferredItemHeight&quot;
      android:orientation=&quot;horizontal&quot; &gt;
  
      &lt;QuickContactBadge
          android:id=&quot;@+id/contactPic&quot;
          style=&quot;@style/ContactPicStyle&quot; /&gt;
  
      &lt;CheckedTextView
          android:id=&quot;@+id/contactInfo&quot;
          style=&quot;@style/ListViewCheckedTextViewRowStyle&quot; &gt;
      &lt;/CheckedTextView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>For some reason, in <code>Fragment B</code> the themed checkMark attribute is not rendering correctly whereas in <code>Fragment A</code>, the checkMark uses the current YellowGreen Theme and is styled correctly.  Why would this be happening?</p>