Search code examples
lwuit

How to coloriate differently even rows and odd rows of a List in LWUIT?


There is a List in a LWUIT application. I want to make odd rows and even rows to be of different colors. How to achieve that ?


Solution

  • You can set two differents UIIDs to the rows. Setting this UIID you can modify selectively the colors of your rows.

    EDIT

    Ok this will be more difficult.

    You need to make a Render and set it in your List with List.setRender(Render r). The ´Render´ class will extend from ListCellRender. In this class you can set UIID to the Render, setting its Selected or Unselected styles.

    See this example. @Shai Almog could have more info for your problem.

    http://www.lwuit.com/2008/07/lwuit-list-renderer-by-chen-fishbein.html