以下代码不适用于设置AutoCompleteTextField弹出窗口的样式。解决办法是什么?
Java:
Form hi = new Form("CSS Test", BoxLayout.y());
AutoCompleteTextField ac = new AutoCompleteTextField("Short", "Shock", "Sholder", "Shrek");
ac.setMinimumElementsShownInPopup(5);
hi.add(ac);
hi.show();
CSS:
AutoCompleteList {
font-size: 2.5mm;
font-family: "native:MainLight";
color: black;
background-color: white;
}
AutoCompleteList.pressed, AutoCompleteList.selected {
color: blue;
}
屏幕截图:
答案 0 :(得分:1)
我刚刚找到了可能的解决方案:
Java
10.0.2.2
和
Form hi = new Form("CSS Test", BoxLayout.y());
AutoCompleteTextField ac = new AutoCompleteTextField("Short", "Shock", "Sholder", "Shrek");
ac.setMinimumElementsShownInPopup(5);
ac.setCompletionRenderer(getCompletionRenderer());
hi.add(ac);
hi.show();
CSS:
private ListCellRenderer getCompletionRenderer() {
DefaultListCellRenderer render = new DefaultListCellRenderer(false);
render.setUIID("MyAutoCompleteList");
return render;
}