I have a TextView in my android application that has a set width on it. It\'s currently got a gravity of \"center_horitonzal\" and a set textSize (9sp). I pull values to put o
I found a way to measure the width of text using the TextView's Paint object, and lower it until it fit in the size I needed. Here's some sample code:
float size = label.getPaint().measureText(item.getTitle());
while (size > 62) {
float newSize = label.getTextSize() - 0.5f;
label.setTextSize(newSize);
size = label.getPaint().measureText(item.getTitle());
}