Friday 13 September 2013

Set Your Wallpaper As Your Application's Theme.

We Can Use our Existing Project For This Tutorial.
I am using my Widget Example Project.
Widget Example

We are Setting Our Wallpaper or Live Wallpaper As our Project's Theme.
Just Open Your AndroidMenifest.xml  FIle.
If you also using our previous Project then your XML will Look Like Below.



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="arshad.widget"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
       
         >
        <activity
            android:name="arshad.widget.MainActivity"
            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>

</manifest>



you can see in your application's content
android:theme="@style/AppTheme"

just remove that line and add below line.

 android:theme="@android:style/Theme.Wallpaper"

this will set your device Wallpaper as your application's theme.
The theme will be change as device wallpaper changes.

Now Your AndroidMenifest File will Look Like Below.




<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="arshad.widget"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
         android:theme="@android:style/Theme.Wallpaper" >
        <activity
            android:name="arshad.widget.MainActivity"
            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>

</manifest>

Now Run Your Application.
My Application is Lokking Like Below.




Set Different Wallpaper's To Your Device And Enjoy :)

All The Best.

No comments:

Post a Comment