我知道ActionBar有许多内置的主题:全息光,全息暗,带有暗ActionBar的全息光……
有没有办法知道,ActionBar当前的主题是黑暗还是光明?
发布于 2014-01-29 13:26:49
在安卓开发者社区(Google+)的建议下,我终于从HoloEverywhere源代码中找到了这样的方法:ThemeManager.getThemeType(context)
public static int getThemeType(Context context) {
TypedArray a = context.obtainStyledAttributes(new int[] {
R.attr.holoTheme
});
final int holoTheme = a.getInt(0, 0);
a.recycle();
switch (holoTheme) {
case 1:
return DARK;
case 2:
return LIGHT;
case 3:
return MIXED;
case 4:
return PreferenceManagerHelper.obtainThemeTag();
case 0:
default:
return INVALID;
}
}https://stackoverflow.com/questions/21421059
复制相似问题