문제

I created a ComboBox of String[] :

genretxt=new ComboBox(new String[]{"Féminin","Masculin"});

The problem is that the popup has a blank item when clicking the ComboBox at runtime , but this blank item is not clickable : even though I click it then the selection remains at the previous selection.

I tried to add the "" String to the array argument of the ComboBox : genretxt = new ComboBox(new String[]{"","Féminin","Masculin"}); but in runtime there is two blank items , so it is not very good to see !

Also the genretxt component's value is not mandatory in my application so the user can select null in the ComboBox.

I tried to derive the ComboBox class and implemented the createPopupList() method but the problem is the same !

So how to make it possible to select a null item in the ComboBox ?

도움이 되었습니까?

해결책

I'm not exactly sure where you see that blank and without an exact way to reproduce, version of LWUIT & theme used there isn't much I can help with there.

In order to allow selecting a blank you need to actually add it to the combo box, there is no way around it. LWUIT has a special case for empty strings where they occupy 0 space. You can resolve it either by having a string like [None] or by calling setRenderingPrototype("XXXXXXXX") or by creating your own renderer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top