TextView的折叠和扩展,可以设置默认行数

2017-02-23  本文已影响0人  MC长乐

<pre>

TextVIew.getLineHeight();

TextView.getLineCount();

private voiddoAnimation(intstartHeight,intendHeight) {

ValueAnimator animator = ValueAnimator.ofInt(startHeight, endHeight);

animator.setDuration(600);

animator.setTarget(mDescribeDetailTv);

animator.addUpdateListener(newValueAnimator.AnimatorUpdateListener() {

@Override

public voidonAnimationUpdate(ValueAnimator animation) {

intheight = (int) animation.getAnimatedValue();

ViewGroup.LayoutParams params =mDescribeDetailTv.getLayoutParams();

params.height= height;

mDescribeDetailTv.setLayoutParams(params);

}

});

animator.start();

}

</pre>

上一篇下一篇

猜你喜欢

热点阅读