I have j2me LWUIT app that uses a list. Each cell in the list contains an image and a text area. The TextArea will not grow. I read that in a List all cells must be uniform size, so I should use ContainerList.
With ContainerList I am having the same problem! My TextAreas will not grow. Here's where I create the TextArea:
TextArea caption = new TextArea();
caption.getStyle().setBgTransparency(255);
caption.getStyle().setBgColor(0x060507);
caption.getStyle().setBorder(null);
caption.getStyle().setFgColor(0xf0f0f0);
caption.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM));
caption.getStyle().setMargin(0,10,10,10);
caption.setText(m.caption_text);
caption.setGrowByContent(true);
caption.setSingleLineTextArea(false);
cellCon.addComponent(caption);
cellCon is a vertical BoxLayout. Even if I remove the image, still they will not expand. If I change cellCon to use a BorderLayout and place the image NORTH and the TextArea SOUTH, the TextArea does expand, but overlaps the image (as though it's still trying to maintain a uniform height).
I am creating the ContainerList like this:
list = new ContainerList(new BoxLayout(BoxLayout.Y_AXIS),new DefaultListModel(data));
How do I make this work?
Apparently growByContent does not work in ContainerList. I ultimately had to abandon ContainerList, instead using a Container of components. In this context, growByContent works fine.