I have a style

<style name="MyText">
    <item name="android:textColor">#ffff8080</item>
    <item name="android:background">#ffc0c0c0</item></style>


that I would like to introspect in code. I run this code:

final Resources r = getResources();final TypedArray a = 
r.obtainTypedArray(R.style.MyText);try {
    for (int i=0; i<a.length(); ++i) {
        final TypedValue v = a.peekValue(i);
        if (v != null) {
            Log.d(TAG, "assetCookie: " + v.assetCookie);
            Log.d(TAG, "changingConfigurations: " + v.changingConfigurations);
            Log.d(TAG, "data: " + v.data);
            Log.d(TAG, "density: " + v.density);
            Log.d(TAG, "resourceId: " + v.resourceId);
            Log.d(TAG, "string: " + v.string);
            Log.d(TAG, "type: " + v.type);
            Log.d(TAG, "---------------------------------");
        }
    }} finally {
    a.recycle();}


The output is:

D/PlaceholderFragment( 2051): assetCookie: 2
D/PlaceholderFragment( 2051): changingConfigurations: 0
D/PlaceholderFragment( 2051): data: -32640
D/PlaceholderFragment( 2051): density: 0
D/PlaceholderFragment( 2051): resourceId: 0
D/PlaceholderFragment( 2051): string: null
D/PlaceholderFragment( 2051): type: 28
D/PlaceholderFragment( 2051): ---------------------------------
D/PlaceholderFragment( 2051): assetCookie: 2
D/PlaceholderFragment( 2051): changingConfigurations: 0
D/PlaceholderFragment( 2051): data: -4144960
D/PlaceholderFragment( 2051): density: 0
D/PlaceholderFragment( 2051): resourceId: 0
D/PlaceholderFragment( 2051): string: null
D/PlaceholderFragment( 2051): type: 28
D/PlaceholderFragment( 2051): ---------------------------------


>From the output I know the type of the TypedValue and the value it stores. 
I would also be interested to find out which TypedValue is android:textColor 
and 
which is android:background. How can I do that?

Thank you!


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to