Search code examples
listcodenameonerenderer

image and spanlabel render default output in List [CodenameOne]


I took one blank container and add ImageViewer & Spanlabel. Same is render in list but it shows me default output (which i put for test). I Try both ways dynamic and manual still output is same. Even i try to work with Multi-List but it not taking renderer.

Here is My code :

    ArrayList<Map<String, Object>> a = new ArrayList<Map<String, Object>>();
    HashMap<String, Object> m = new HashMap<String, Object>();
    Image image=fetchResourceFile().getImage("puzzle_icon.png");
    m.put("gSR_image", image);
    m.put("gSR_label", "Puzzle");
    a.add(m);
    cmp.setModel(new com.codename1.ui.list.DefaultListModel(a));

see this output

see this output

my renderer screen

my renderer screen

output must be my image and Puzzle written below it.


Solution

  • There is something problem in spanlabel so replace the spanlabel with textarea and unchecked editable which works similar as above .

    ArrayList<Map<String, Object>> a = new ArrayList<Map<String, Object>>();
    HashMap<String, Object> m = new HashMap<String, Object>();
    Image image=fetchResourceFile().getImage("puzzle_icon.png");
    m.put("gSR_image", image);
    **m.put("gSR_textarea", "its working");**
    a.add(m);
    cmp.setModel(new com.codename1.ui.list.DefaultListModel(a));