Skip to content

Instantly share code, notes, and snippets.

@martinadamek
Created January 5, 2011 01:18
Show Gist options
  • Save martinadamek/765774 to your computer and use it in GitHub Desktop.
Save martinadamek/765774 to your computer and use it in GitHub Desktop.
int maxWidth = viewHolder.viewGroup.getWidth();
TextPaint textPaint = viewHolder.titleView.getPaint();
String title = cursor.getString(ArticlesQuery.TITLE);
int chars = textPaint.breakText(title, true, maxWidth, null);
if (chars < title.length()) {
title = title.substring(0, chars);
}
viewHolder.titleView.setText(title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment