Code example for StaticLayout

Methods: getHeight

    // Set the text size of the text paint object and use a static layout to render text off screen before measuring 
    private int getTextHeight(CharSequence source, TextPaint paint, int width, float textSize) {
        // Update the text paint object 
        // Measure using a static layout 
        StaticLayout layout = new StaticLayout(source, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, true);
        return layout.getHeight();
Connect your IDE to all the code out there  Get Codota for Java