Skip to content

Instantly share code, notes, and snippets.

@TangKe
Last active December 22, 2015 17:28
Show Gist options
  • Save TangKe/6506295 to your computer and use it in GitHub Desktop.
Save TangKe/6506295 to your computer and use it in GitHub Desktop.
获取当前theme的某个属性引用的值
TypedArray typedArray = obtainStyledAttributes(null,new int[] { android.R.attr.listSelector },android.R.attr.listViewStyle, 0);
Drawable drawable = typedArray.getDrawable(0);
或者
TypedValue value = new TypedValue();
getResource().getTheme().resolveAttribute(android.R.attr.listSelector, value, true);
value.getDrawable();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment