通过创建我的迷你项目学习一些libGDX,我决定我需要文本输入,创建文本字段,皮肤,但导入默认皮肤时出错。
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException:
com.badlogic.gdx.utils.SerializationException: Error reading file: data/uiskin.json
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:113)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: data/uiskin.json
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:95)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:72)
at com.me.bpmtest.BpmTest.create(BpmTest.java:47)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:127)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: data/uiskin.json
at com.badlogic.gdx.utils.Json.fromJson(Json.java:613)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:93)
... 4 more
Caused by: com.badlogic.gdx.utils.SerializationException: Field not found: scrollStyle (com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle)
at com.badlogic.gdx.utils.Json.readFields(Json.java:703)
at com.badlogic.gdx.utils.Json.readValue(Json.java:816)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:409)
at com.badlogic.gdx.utils.Json.readValue(Json.java:766)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.readNamedObjects(Skin.java:434)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:422)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:415)
at com.badlogic.gdx.utils.Json.readValue(Json.java:791)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:409)
at com.badlogic.gdx.utils.Json.fromJson(Json.java:611)
... 5 more
我使用来自here的默认皮肤文件 这是我的创建函数的代码片段:
public void create() {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
//Gdx.input.setOnscreenKeyboardVisible(true); - for android later.
AndroidInput listener = new AndroidInput();
stage = new Stage();
textfield = new TextField("", skin);
textfield.setMessageText("Enter Push number");
....
}
我真的只是一个初学者,也许有更简单的方法来获取文本输入?我需要从用户那里获得整数。
答案 0 :(得分:0)
检查libgdx启动屏幕上的工具框。然后,您将拥有许多libgdx示例中使用的所有默认文件,包括uiskin.json。完成后,您只需拨打Gdx.files.internal("uiskin.json")