29 Dec 2012


How to change the Theme in Android App

Theme in Android means applying the same style to a single activity or whole application .
Note:
  • If you will apply theme to a single activity then the style will appear to that particular activity .
  • If you will apply theme to whole application then the style will appear to the whole application.
Theme 1
Now lets us learn how to change the theme in android.
  • Now start with a project by selecting new-> file-> Android Application Project.
  • Fill the following details in the project.
  • Theme 2
    • Application Name- AndroidTheme
    • Project Name -AndroidTheme
    • Package Name- theme.android
    • Minimum required SDK - 2.2 froyo  and then click next and next then finish.
  • Now open your project explorer you will see the following three folder under res folder.
Theme 3


  • value - it contain themes and styles for android API 10 and lower version.

  • value-v11- it contain themes and styles for Android API 11 to API 13.

  • value-v14- it contain themes and styles for Android API 14 and Higher.






  • Lets change the theme,Open the values-v14 folder because here i have configured my emulator for android 4.1(API 16)  then open styles.xml
    • In styles.xml you will see the following line .here the themeTheme.Holo.Light.DarkActionBar
       <resources>  
         <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />  
       </resources>  
      

    • Now we will change the theme ie. Theme.Holo.Light.NoActionBar so final code will look like this.
    •  <resources>  
         <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar" />  
       </resources>  
      

    • Now when you will run this you will see following change.
      Theme 4
      (Before)Theme.Holo.Light.DarkActionBar
      Theme 5
      (After)Theme.Holo.Light.NoActionBar

      For applying various themes in android visit Available theme in Android

      1 comment:

      1. I don't cerebrate some of websites offer this typewrite of assemblage. premium wordpress themes

        ReplyDelete

      Translate