BubbleTextView.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Fairphone 作者:
/**
 * Draw this BubbleTextView into the given Canvas.
 *
 * @param destCanvas the canvas to draw on
 * @param padding the horizontal and vertical padding to use when drawing
 */
private void drawWithPadding(Canvas destCanvas, int padding) {
    final Rect clipRect = mTempRect;
    getDrawingRect(clipRect);

    // adjust the clip rect so that we don't include the text label
    clipRect.bottom =
        getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + getLayout().getLineTop(0);

    // Draw the View into the bitmap.
    // The translate of scrollX and scrollY is necessary when drawing TextViews, because
    // they set scrollX and scrollY to large values to achieve centered text
    destCanvas.save();
    destCanvas.scale(getScaleX(), getScaleY(),
            (getWidth() + padding) / 2, (getHeight() + padding) / 2);
    destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
    destCanvas.clipRect(clipRect, Op.REPLACE);
    draw(destCanvas);
    destCanvas.restore();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号