直接上代码:
final LayoutParams lp = mTextView.getLayoutParams();
width += 5;
lp.width = width;
lp.height=20;//lp.height=LayoutParams.WRAP_CONTENT;
mTextView.setLayoutParams(lp);
该方法适用于其他View
http://www.cnblogs.com/over140/archive/2012/09/14/2684652.html