지식쌓기
Android - theme의 color 얻어오기
바나나쥬스
2014. 6. 3. 16:27
android.R.attr 참조를 이용하여
현재 theme의 리소스 정보 얻어오기..
TypedArray a = getTheme().obtainStyledAttributes(new int[] {
android.R.attr.windowBackground
});
Drawable backgroundDrawable = a.getDrawable(0);
a.recycle();
TypedArray a = getTheme().obtainStyledAttributes(new int[] {
android.R.attr.colorBackground,
android.R.attr.textColorPrimary,
});
int backgroundColor = a.getColor(0, 0);
int textColor = a.getColor(1, 0);
a.recycle();