Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int[] attrs = {
- android.R.attr.textColor,
- android.R.attr.text,
- };
- /*
- <style name="AppTheme" parent="android:Theme.Holo">
- <item name="android:listViewStyle">@style/myStyle</item>
- </style>
- <style name="myStyle">
- <item name="android:textColor">#0f0</item>
- <item name="android:text">hello world</item>
- </style>
- */
- Resources.Theme theme = getTheme();
- TypedValue tv = new TypedValue();
- theme.resolveAttribute(android.R.attr.listViewStyle, tv, true);
- TypedArray ta = theme.obtainStyledAttributes(tv.resourceId, attrs);
- Log.d(TAG, "getColor: " + Integer.toHexString(ta.getColor(0, -1)));
- Log.d(TAG, "getString: " + ta.getString(1));
- ta.recycle();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement