Code example for Layout

Methods: getLineBottom

0
     * Get how many lines of text we can display so their full height is visible. 
     */ 
    private int getFullyVisibleLinesCount() { 
        Layout layout = createWorkingLayout("");
        int height = getHeight() - getPaddingTop() - getPaddingBottom();
        int lineHeight = layout.getLineBottom(0);
        return height / lineHeight;
    } 
 
    /** 
     * Get how many lines of text we are allowed to display. 
     */ 
    private int getLinesCount() { 
        int result = 0;
        if (ellipsizingLastFullyVisibleLine()) { 
            int fullyVisibleLinesCount = getFullyVisibleLinesCount();
            if (fullyVisibleLinesCount == -1) {
                result = 1;
            } 
            else { 
                result = fullyVisibleLinesCount;