[英]Old activity not picking up on a theme I created, but new activities do. How do I get the old one to use my theme?
[英]How do we get the theme of an Activity?
我试图检测用于活动的主题,但到目前为止我只能找到整个应用程序的主题? 有没有办法做到这一点?
只需在您的活动中调用getTheme()方法即可。 例如。
public class MainActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Theme theme = this.getTheme();
}
}
我的第一个想法是ContextThemeWrapper.getTheme() ,因为Activity
扩展了ContextThemeWrapper
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.