Why is it that both outs are printing 84? The first one should read 84, the second should read 220. If I click a second time, both outs read 220.
public void btnClick(View v) {
System.out.println(textView1.getWidth());
textView1.setTextSize(TypedValue.COMPLEX_UNIT_PX, 55);
System.out.println(textView1.getWidth());
}
Changing text size will not change the size of the view if it has already been measured. SetTextSize() will trigger an invalidate(), but that only triggers an onDraw() in the future. The view will not be measured again, and its width and height will remain the same. You can call requestLayout() on the view to get the width and height recalculated.
If you just want to see the size of the text after changing the size (in terms of its dimensions) you can try http://developer.android.com/reference/android/graphics/Paint.html#getTextBounds(char%5B%5D, int, int, android.graphics.Rect)