Wednesday, December 30, 2009

Use system wallpaper as application's wallpaper

Just as Android provides other built-in resources, there are several themes that you swap in without having to write one yourself.

To set this theme for all the activites of your application, open the AndroidManifest.xml file and edit the <application> tag to include the android:theme attribute with the theme name.

If you want the theme applied to just one Activity in your application, then add the theme attribute to the <activity> tag, instead.

If you want to use system wallpaper as your own application's wall paper, add android:theme="@android:style/Theme.Wallpaper" in your AndroidManifest.xml.

Example:



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.exercise.AndroidSysTheme"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@android:style/Theme.Wallpaper"
>
<activity android:name=".AndroidSysTheme"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<uses-sdk android:minSdkVersion="5" />

</manifest>


No comments: