How to get the default colors on Android
<p>I have a custom component that I want to give the same colors as a TextView.
That is, I don't want to copy its colors, I want to get the default background and foreground colors, if there's such a concept on android.</p>

<p>[Edit]</p>

<p>The following seems to yield the text color of my TextView. But is it just luck? It's not intuitive to me that a default TextView would use <code>android.R.attr.textColorSecondary</code>? And why does not <code>resolveAttribute</code> return the color directly?</p>

<pre><code>TypedValue tv = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.textColorSecondary, tv, true);
Color holyColor = getResources().getColor(tv.resourceId);
</code></pre>

<p>[Edit]</p>

<p>I found the source code of TextView at <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob_plain;f=core/java/android/widget/TextView.java;hb=HEAD" rel="nofollow">android.git.kernel.org</a>, but it seemed to contain a lot of referrences to <code>com.android.internal.R</code>, which I don't think I should use in my own code. I'm currently looking for some kind of evidence that <code>TextView</code> uses <code>android.R.attr.textColorSecondary</code>.</p>

<p>[Edit]</p>

<p>I found some kind of evidence at <a href="http://developer.android.com/guide/topics/ui/themes.html#PlatformStyles" rel="nofollow">developer.android.com</a>, in <a href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/values/styles.xml;h=d7b654e49809cb97a35682754b1394af5c8bc88b;hb=HEAD" rel="nofollow">styles.xml</a> that <code>TextView</code> uses <code>android.R.attr.textAppearanceSmall</code>. <code>textAppearanceSmall</code> is documented to default to "secondary text color".</p>

<p>I guess I was lucky after all, but I still don't like that little code snippet of mine.</p>
