请帮忙设计 Vaadin 中的 ListSelect 样式,是否可以将其设置为选择列表中的第一项?可以设置item的高度吗?我需要设置每个项目的大小,因为列表将用于触摸显示。
谢谢
最佳答案
Is it possible to set it up the height of the item?
有点是的。 ListSelect 可以很好地适应其字体大小,因此您可以执行以下操作:在 Java 代码中像这样:
ListSelect select = new ListSelect();
...
select.setStyleName("my-select");
然后在您的主题中定义不同的字体样式,例如
.my-select {
font: 300 12px "Open Sans", sans-serif;
}
Is it possible to set it up for choosing the first item at the list?
listSelect.setValue(item) 或 listSelect.select(item) 以编程方式选择项目。
如果您不知道哪一个是第一项,您可以例如使用
item = listSelect.getDataCommunicator().fetchItemsWithRange(0,1);
获取第一个项目
关于list - aVdin 8 中的样式列表选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51375272/