1
\$\begingroup\$

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");
\$\endgroup\$
1

1 Answer 1

2
\$\begingroup\$

You can do this using:

selectBoxStyle.listStyle.selection.setTopHeight(10);
\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .