Code example for TextPaint

Methods: ellipsize, setColor, setTextSize

0
					mText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		} 
	} 
 
	private void calculateDrawingData() { 
		sDefaultPaint.setTextSize(mCoordinates.detailFontSize);
		calculateDetailText(); 
		// mText 
		mDetailLayout = new StaticLayout(mText, sDefaultPaint,
				mCoordinates.detailWidth, Alignment.ALIGN_NORMAL, 1, 0, false /* includePad */);
		if (mCoordinates.detailLineCount < mDetailLayout.getLineCount()) {
			// TODO: ellipsize. 
			int end = mDetailLayout
					.getLineEnd(mCoordinates.detailLineCount - 1);
			mDetailLayout = new StaticLayout(mText.subSequence(0, end),
					sDefaultPaint, mCoordinates.detailWidth,
					Alignment.ALIGN_NORMAL, 1, 0, true);
		} 
 
		// Now, format the name for its width 
		TextPaint namePaint = mRead ? sDefaultPaint : sBoldPaint;
		// And get the ellipsized string for the calculated width 
		if (TextUtils.isEmpty(mSender)) {
			mFormattedFileName = "";
		} else { 
			int nameWidth = mCoordinates.nameWidth;
			namePaint.setTextSize(mCoordinates.nameFontSize);
			namePaint.setColor(getFontColor(FILE_NAME_TEXT_COLOR));
			mFormattedFileName = TextUtils.ellipsize(mSender, namePaint,
					nameWidth, TruncateAt.END);
		} 
	} 
 
	@Override