Q: How to get the default colors on Android 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.
[Edit]
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 android.R.attr.textColorSecondary? And why does not resolveAttribute return the color directly?
TypedValue tv = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.textColorSecondary, tv, true);
Color holyColor = getResources().getColor(tv.resourceId);

[Edit]
I found the source code of TextView at android.git.kernel.org, but it seemed to contain a lot of referrences to com.android.internal.R, which I don't think I should use in my own code. I'm currently looking for some kind of evidence that TextView uses android.R.attr.textColorSecondary.
[Edit]
I found some kind of evidence at developer.android.com, in styles.xml that TextView uses android.R.attr.textAppearanceSmall. textAppearanceSmall is documented to default to "secondary text color".
I guess I was lucky after all, but I still don't like that little code snippet of mine.

A: What you're looking for are attributes.  Attributes link widgets to styles.  For example, android:background is what you'd set for a particular view, but there's attributes like android:panelBackground and android:windowBackground that you can use override to affect the system as a whole.
You should look through R.attr and then link to those attributes in your widget.  There should be a number of them that are linked to TextView; it would make sense to download the Android source code and see which attributes are used.
