Blackberry downsize font to fit list line

I am using ListField to draw text. The problem is that the text is larger than the screen width and the remaining text does not appear. Is there a way to reduce the font size for certain lines, the text content is more suitable for the drawing area of ​​the ListField.

+2


source to share


1 answer


In your ListFieldCallback code, you will have a drawListRow () method. Choose a font:



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);
}

      

+3


source







All Articles