사용
TypedValue typedValue = new TypedValue();
((Activity)context).getTheme().resolveAttribute(android.R.attr.textAppearanceLarge, typedValue, true);
문자열의 경우 :
typedValue.string
typedValue.coerceToString()
기타 데이터 :
typedValue.resourceId
typedValue.data // (int) based on the type
귀하의 경우 반환되는 것은 TYPE_REFERENCE.
TextAppearance 를 가리켜 야한다는 것을 알고 있습니다.
그것은 :
<style name="TextAppearance.Large">
<item name="android:textSize">22sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">?textColorPrimary</item>
</style>
이 문제를 해결하기 위해 Martin이 신용을 얻습니다.
int[] attribute = new int[] { android.R.attr.textSize };
TypedArray array = context.obtainStyledAttributes(typedValue.resourceId, attribute);
int textSize = array.getDimensionPixelSize(0, -1);