我想制作安卓动态壁纸。我想使用 LibGDx。我找到了这个信息: http://www.badlogicgames.com/wordpress/?p=2652
不幸的是,将代码复制到我的墙纸后,eclipse 显示错误。
有谁知道如何使用 LibGDx 制作壁纸?
Eclipse 显示以下信息:“MyApplicationListener 无法解析为类型”? 有 3 个快速修复可用: 1. 创建类 MyApplicationListener 2.更改为“ApplicationListener”(com.badlogic.gdx) 3.修复项目设置
选择2修复后,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);
}
}
最佳答案
将您的代码恢复原样。
选择选项 3 进行快速修复。
它应该在您的构建路径中包含您的 Main Gdx 项目并修复该错误。
手动转到 Java-Build-Path/Projects 选项卡并添加您的 Gdx 项目。
您的后端项目需要访问您的主要 gdx 项目才能找到该类。
关于android - 如何使用 LibGDx 制作安卓动态壁纸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13690207/