Code example for Layout

Methods: draw, getHeight, getWidth

0
        Point point = drawViewAdapter.getTextPointAt( position );
        canvas.save();
        canvas.translate( point.x, point.y );
        Layout layout = drawViewAdapter.getTextLayoutAt( position );
        doDrawUnderTextPaint( canvas, layout );
        layout.draw( canvas );
        canvas.restore();
    } 
 
    /** 
     * Draw some surface under text. This method is called just before drawing each {@link LabeledPoint}'s text. 
     *  
     * @param canvas 
     *            the canvas in which we draw. 
     * @param layout 
     *            the {@link Layout} associated to a {@link LabeledPoint}. 
     */ 
    protected void doDrawUnderTextPaint( Canvas canvas, Layout layout ) {
        if ( underTextPaint != null ) {
            int margin = DRAW_UNDER_TEXT_CORNER_RADIUS;
            RectF rect = new RectF( -margin, -margin, layout.getWidth() + margin * 2, layout.getHeight() + margin * 2 );
            canvas.drawRoundRect( rect, 2 * margin, 2 * margin, underTextPaint );
        } 
    } 
 
    /**