I'm trying to implement a function that when a TextView
contains too many lines of text, it can be collapsed into 2 lines after a user taps a button. It is expected that when the user taps that button again, the TextView
should then show the full text it contains.
In the collapseView()
method, I use setEllipsize
as below:
private void collapseView() {
m_vwText.setMaxLines(2);
m_vwText.setEllipsize(TruncateAt.END);
m_vwExpandButton.setText(EXPAND);
}
So I wonder what should I do in my expandView()
method to show all lines contained in the TextView
. Please help and thanks in advance.