Code example for TextPaint

Methods: getFontMetricsIntmeasureText

0
     * @return whether the label width has changed in case it returns true. 
     */ 
    private boolean measureLabelText(int width) {
	int oldlabelw = mLabelWidth;
	mLabelWidth = Math.max(
		(int) mTextLabelPaint.measureText(mTextLabel, 0,
			mTextLabel.length()), mLabelWidth);
	mLabelHeight = mTextLabelPaint.getFontMetricsInt(mLabelFontMetrics);
	// If measured width for label is equal or over the maximum allowed 
	// width make label and text share space by half. 
	// TODO: review the case where the label is too long... 
	// mLabelWidth = mLabelWidth >= width ? width / 2 : mLabelWidth; 
	return mLabelWidth != oldlabelw;
    } 
 
    private int getDesiredHeight() { 
	if (mLayout == null) {
	    return 0; 
	} 
 
Connect your IDE to all the code out there  Get Codota for Java