Android - Expandable TextView with Animation

后端 未结 15 1058
小蘑菇
小蘑菇 2020-11-28 18:24

I have a TextView which firstly shows a small portion of a long text.

The user can press a \"see more\" button to expand the TextView and s

15条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 19:12

    Now, it's even more easy to provide the requested TextView with animation and all the required controls using this awesome library ExpandableTextView, in this library you have only to add it into your gradle and then define it like the following in your xml:

      
          
          
      
    

    and after that use it in your code like:

    TextView expandableTextView = (ExpandableTextView) findViewById(R.id.expand_text_view);
    

    And as you see you can control the max lines you want and the animation duration and all the required settings for your TextView expand technique.

提交回复
热议问题