android动态壁纸调用的简单实例

动态壁纸的实现其实就是在Activity中调用动态壁纸服务,通过绑定服务得到IWallpaperService,调用该接口中的attach函数实现壁纸的调用。

调用后动态壁纸其实是显示在Activity的后面,而Activity则是透明显示,这样就可以看到下面的动态壁纸,如果Activity不是透明的则什么也看不到。

代码中有用到两个接口

IWallpaperService mService;

IWallpaperEngine mEngine;

我们可以看到该目录下面有三个aidl接口,分别是

复制代码 代码如下:

interface IWallpaperConnection {

    void attachEngine(IWallpaperEngine engine);

    ParcelFileDescriptor setWallpaper(String name);

}

oneway interface IWallpaperService {

    void attach(IWallpaperConnection connection,

            IBinder windowToken, int windowType, boolean isPreview,

            int reqWidth, int reqHeight);

}


oneway interface IWallpaperEngine {

    void setDesiredSize(int width, int height);

    void setVisibility(boolean visible);

    void dispatchPointer(in MotionEvent event);

    void dispatchWallpaperCommand(String action, int x, int y,            int z, in Bundle extras);

    void destroy();

}

以上就是android动态壁纸调用的简单实例的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 移动