问题
I am trying to implement Dialog from libGDX When reading json file for Skin I get an error.
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: No Drawable, NinePatch, TextureRegion, Texture, or Sprite registered with name: white
I added uiskin.atlas, default.fnt, uiskin.png to the project Code uiskin.json
{
BitmapFont: { default-font: { file: default.fnt } },
Color: {
green: { a: 1, b: 0, g: 1, r: 0 },
white: { a: 1, b: 1, g: 1, r: 1 },
red: { a: 1, b: 0, g: 0, r: 1 },
black: { a: 1, b: 0, g: 0, r: 0 },
},
TintedDrawable: {
dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } },
},
ButtonStyle: {
default: { down: default-round-down, up: default-round },
toggle: { parent: default, checked: default-round-down }
},
TextButtonStyle: {
default: { parent: default, font: default-font, fontColor: white },
toggle: { parent: default, checked: default-round-down, downFontColor: red }
},
ScrollPaneStyle: {
default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
SelectBoxStyle: {
default: {
font: default-font, fontColor: white, background: default-select,
scrollStyle: default,
listStyle: { font: default-font, selection: default-select-selection }
}
},
SplitPaneStyle: {
default-vertical: { handle: default-splitpane-vertical },
default-horizontal: { handle: default-splitpane }
},
WindowStyle: {
default: { titleFont: default-font, background: default-window, titleFontColor: white },
dialog: { parent: default, stageBackground: dialogDim }
},
ProgressBarStyle: {
default-horizontal: { background: default-slider, knob: default-slider-knob },
default-vertical: { background: default-slider, knob: default-round-large }
},
SliderStyle: {
default-horizontal: { parent: default-horizontal },
default-vertical: { parent: default-vertical }
},
LabelStyle: {
default: { font: default-font, fontColor: white }
},
TextFieldStyle: {
default: { selection: selection, background: textfield, font: default-font, fontColor: white, cursor: cursor }
},
CheckBoxStyle: {
default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white }
},
ListStyle: {
default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font: default-font }
},
TouchpadStyle: {
default: { background: default-pane, knob: default-round-large }
},
TreeStyle: {
default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
},
TextTooltipStyle: {
default: {
label: { font: default-font, fontColor: white },
background: default-pane, wrapWidth: 150
}
},
}
I took all these files with https://github.com/libgdx/libgdx/tree/master/tests/gdx-tests-android/assets/data
来源:https://stackoverflow.com/questions/62968275/how-to-fix-error-reading-json-file-in-libgdx