Android Textview Height & Width Measurement

Width

float width = textview.getPaint().measureText(text);  

Height

View parent = (View) textview.getParent();  
final int widthSpec = View.MeasureSpec.makeMeasureSpec(parent.getMeasuredWidth() -  
                      parent.getPaddingLeft() - 
                      parent.getPaddingRight(), View.MeasureSpec.AT_MOST);

final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);  
textview.measure(widthSpec, heightSpec);

height = textview.getMeasuredHeight();