I have created a Select Box (Scene2D widget) which holds a list of items, to be selected. My code works fine, but I would like to make a little more spacing between each list item in the dropdown list in the select box. How can I achieve that??

My code for the list box is this.

List.ListStyle selectBoxListStyle = new List.ListStyle();
selectBoxListStyle.background = new NinePatchDrawable(new NinePatch(this.selectBoxListBackgroundTexture, 10, 10, 10, 10));
selectBoxListStyle.font = this.textFieldFont;
selectBoxListStyle.fontColorSelected = Color.WHITE;
selectBoxListStyle.fontColorUnselected = Color.BROWN;
selectBoxListStyle.selection = new TextureRegionDrawable(new TextureRegion(this.textFieldSelectionTexture));

SelectBox.SelectBoxStyle selectBoxStyle = new SelectBox.SelectBoxStyle();
selectBoxStyle.background = new TextureRegionDrawable(new TextureRegion(this.selectBoxMiddleBackgroundTexture));
selectBoxStyle.backgroundOpen = new TextureRegionDrawable(new TextureRegion(this.selectBoxMiddleActiveBackgroundTexture));
selectBoxStyle.font = this.textFieldFont;
selectBoxStyle.fontColor = Color.WHITE;
selectBoxStyle.listStyle = selectBoxListStyle;
selectBoxStyle.scrollStyle = new ScrollPane.ScrollPaneStyle();

SelectBox<String> selectBoxWidget = new SelectBox(selectBoxStyle);
selectBoxWidget.setItems("Test 1", "Test 2", "Test 3");

You can do this using:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.