Animate MaxLines and Ellipsize

前端 未结 4 1142
误落风尘
误落风尘 2020-12-13 06:51

I have textview which contains a part of a text. When the user clicks the arrow, the textview resizes so the full text is shown. See the images below for an example:

4条回答
  •  攒了一身酷
    2020-12-13 07:37

    You can achieve this using an ObjectAnimator

    ObjectAnimator animation = ObjectAnimator.ofInt(
            tvText,
            "maxLines", 
            25);
    animation.setDuration(4000);
    animation.start();
    

    This will increase the "maxLines" property of the "tvText" TextView from whatever it initially is set to, to 25, over the period of 4000 milliseconds.

    See more here and here.

提交回复
热议问题