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.
Now if you like a theme and want to alter it of tweak it then follow this blog.
- Now start with a project by selecting new-> file-> Android Application Project.
- Fill the following details in the project.
- 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.
- 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 theme Theme.Holo.Light.DarkActionBar
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" />
</resources>
- Now edit it by adding the themes as a parent theme of your custom theme so that following code look like this:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar" >
<item name="android:textSize">42dp</item>
</style>
</resources>
- Now when you will run this project you will see following change.
|
After |
|
Before
|
- In this way you can alter the attribute and change every aspect of a theme.
No comments:
Post a Comment