How to implement 2 themes in Android app -


i have android app got orange background, , actionbar gray, , buttons dark orange. want implement second theme user can choose, changing style in activities pink, blue actionbar , blue buttons.

but im not sure how implement it... hoping this:

<theme name="orange">   <style name="myactivitybackground">     <item name="background">@drawable/orangepattern</item>   </style>   <style name="titlebar">     <item name="background">@color/gray</item>     <item name="color">@color/white</item>     <item name="textsize">20sp</item>   </style>   <style name="mybuttonstyle">     <item name="background">@color/darkorange</item>     <item name="color">@color/black</item>     <item name="textsize">15sp</item>   </style> </theme>  <theme name="pink">   <style name="myactivitybackground">     <item name="background">@drawable/pinkpattern</item>   </style>   <style name="titlebar">     <item name="background">@color/blue</item>     <item name="color">@color/white</item>     <item name="textsize">20sp</item>   </style>   <style name="mybuttonstyle">     <item name="background">@color/blue</item>     <item name="color">@color/white</item>     <item name="textsize">15sp</item>   </style> </theme> 

and layout somehting like:

<linearlayout   android:layout_width="match_parent"   android:layout_height="match_parent"   android:orientation="vertical"   android:style="@style/myactivitybackground">      <textview       android:layout_width="wrap_content"       android:layout_height="match_parent"       android:style="@style/titlebar"       android:text="my title"/>    <button       android:layout_width="wrap_content"       android:layout_height="match_parent"       android:text="click me"       android:style="mybuttonstyle"/>  </linearlayout> 

and want have button somewhere can trigger change pink => orange , orange => pink theme following onclick action:

settheme(r.style.pink); or settheme(r.style.orange); 

is possible?

its using classes in html

<div id="activity" class="pink">   <h1 clas="titlebar">my title</h1>   <input type="submit" class="mybuttonstyle" value="click me"> </div>  <style> .orange {   background: url(../orangepattern.jpg); } .orange .titlebar {   background: gray;   color: white;   font-size: 20px; } .orange .mybuttonstyle {   background: darkorange;   color: black;   font-size: 15px; }  .pink {   background: url(../pinkpattern.jpg); } .pink .titlebar {   background: blue;   color: white;   font-size: 20px; } .pink .mybuttonstyle {   background: blue;   color: white;   font-size: 15px; } 

and have javascript change #activity class pink orange. result in entire page render in diffrent color. can understand im trying do, , give me hint of how continue ?

follow tutorial:

http://www.androidengineer.com/2010/06/using-themes-in-android-applications.html

i think include problem.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -