Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. int[] attrs = {
  2. android.R.attr.textColor,
  3. android.R.attr.text,
  4. };
  5. /*
  6. <style name="AppTheme" parent="android:Theme.Holo">
  7. <item name="android:listViewStyle">@style/myStyle</item>
  8. </style>
  9.  
  10. <style name="myStyle">
  11. <item name="android:textColor">#0f0</item>
  12. <item name="android:text">hello world</item>
  13. </style>
  14. */
  15. Resources.Theme theme = getTheme();
  16. TypedValue tv = new TypedValue();
  17. theme.resolveAttribute(android.R.attr.listViewStyle, tv, true);
  18. TypedArray ta = theme.obtainStyledAttributes(tv.resourceId, attrs);
  19. Log.d(TAG, "getColor: " + Integer.toHexString(ta.getColor(0, -1)));
  20. Log.d(TAG, "getString: " + ta.getString(1));
  21. ta.recycle();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement