我想制作Android动态壁纸,希望使用LibGDx。我找到了这个信息:http://www.badlogicgames.com/wordpress/?p=2652。但是,在将代码复制到我的壁纸后,Eclipse显示错误。有人知道如何使用LibGDx制作壁纸吗?Eclipse显示以下信息:“MyApplicationListener无法解析为类型”?有3个快速修复可用:1.创建类MyApplicationListener;2.更改为“ApplicationListener”(com.badlogic.gdx);3.修复项目设置。选择第二种修复后,Eclipse显示另一个错误:“无法实例化类型ApplicationListener”。在HaMMeReD的帮助下,我解决了问题。我的Android项目代码如下:
public class MainActivity extends AndroidLiveWallpaperService {
@Override
public ApplicationListener createListener(boolean isPreview) {
// TODO Auto-generated method stub
return new SexyWomen();// here should be wrote name of class form main LibGDx project
}
@Override
public AndroidApplicationConfiguration createConfig() {
// TODO Auto-generated method stub
return new AndroidApplicationConfiguration();
}
@Override
public void offsetChange(ApplicationListener listener, float xOffset, float yOffset, float xOffsetStep, float yOffsetStep,
int xPixelOffset, int yPixelOffset) {
// TODO Auto-generated method stub
Gdx.app.log("LiveWallpaper", "offset changed: " + xOffset + ", " + yOffset);
}
}