android - How to change the Theme of an activity after it is created? -
android - How to change the Theme of an activity after it is created? -
after creating activity, how can alter theme new one, example, theme.holo
.
is possible?
you cannot alter theme of activity after created. can alter theme before views added, not after.
as per the docs settheme(int)
:
note should called before views instantiated in context (for illustration before calling setcontentview(view) or inflate(int, viewgroup)).
if wish alter theme before views added, can in oncreate()
so:
public void oncreate(bundle savedinstancestate) { settheme(mythemeresourceid); super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); }
android android-theme
Comments
Post a Comment