views:

250

answers:

1

Hi there,

i am using the ListField for drawing the text ,Problem is if the size of the text is more then the screen width the remaining text is not appearing.Is there any way where i can reduce the font size for a particular rows whose text content is more to fit in to the ListField drawing region.

+2  A: 

In your ListFieldCallback code you will have a drawListRow() method. Select the font there:

public void drawListRow(ListField list, Graphics g, int index, int y, int w) 
{
    // Set text to draw in textString:

    String textString = ...
    Font smallerFont = FontFamily.forName(FontFamily.FAMILY_SYSTEM).getFont(fontStyle,
        fontSize);
    g.setFont(smallerFont);
    g.drawText(textString, 0, y, DrawStyle.TOP|DrawStyle.LEFT, w);
}
Richard