A proper solution for expanding a TextView with a ‘read more’ button

Example
  • can’t handle newlines inside the text
  • don’t put the read more text at the end of the line, but at a random place in the last line. When you have lot of list items below each other, this seems quite annoying
  • they all use a layout listener. This means that they first lay out the text, and then calculate the positions, which results in a second layout. This is unnecessary and the jumping is also visible for the user. If you are scrolling down fast, this is easily noticeable.
textView.setResizableText(longText, 4, false)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store