[Android动态壁纸的制作教程.doc

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[Android动态壁纸的制作教程

动态壁纸是在Android 2.1新增的一个功能。动态壁纸可以添加到Android的桌面,具有交互式的动画背景效果。在本教程中,我们将教会你如何去制作一个交互式的动态壁纸。 动态壁纸是一个Android应用程序,包括一个服务(WallpaperService)。该服务必须包括一个引擎(WallpaperService.Engine)。该引擎是连接用户、桌面、系统之间的桥梁。它也可以绘制桌面壁纸。 首先,必须由内在的Engine类创建一个WallpaperService类。该服务必须在AndroidManifest.xml中声明为android.service.wallpaper.WallpaperService,这样它才会作为动态壁纸被手机识别。而且还要在服务配置中附加android.permission.BIND_WALLPAPER的权限许可: [size=+0] service android:name=LiveWallpaperService android:enabled=true android:icon=@drawable/icon android:label=@string/app_name android:permission=android.permission.BIND_WALLPAPER intent-filter android:priority=1 action android:name=android.service.wallpaper.WallpaperService / /intent-filter meta-data android:name=android.service.wallpaper android:resource=@xml/wallpaper / /service 复制代码 创建一个XML文件,放置在应用程序目录下的/res/xml/中。它用来描述你的动态壁纸。 ?xml version=1.0 encoding=UTF-8? wallpaper xmlns:android=/apk/res/android android:thumbnail=@drawable/thumbnail android:description=@string/description android:settingsActivity=PreferenceActivity/ 复制代码 再创建一个xml的属性文件,代码如下: [size=+0] declare-styleable name=Wallpaper !-- Component name of an activity that allows the user to modify the current settings for this wallpaper. -- attr name=settingsActivity / !-- Reference to a the wallpapers thumbnail bitmap. -- attr name=thumbnail format=reference / !-- Name of the author of this component, e.g. Google. -- attr name=author format=reference / !-- Short description of the components purpose or behavior. -- attr name=description / /declare-styleable 复制代码 动态壁纸的服务代码如下: [size=+0] package net.androgames.blog.sample.livewallpaper; import android.content.SharedPreferences; import android.service.wallpaper.WallpaperService; import android.view.MotionEvent; import android.view.SurfaceHolder; /** * Android Live Wallpaper Archetype * a href=/arthor target=_blank rel=nofollow@author/a antoine vianey * under GPL v3 : /licenses/gpl-3.0.html */ public class LiveWallpaperService extends WallpaperService { @Overri

文档评论(0)

xiaoyi2013 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档