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:
The TextView has a wrap_content height, and when collapsed a maxLines="4".
The onClick of the arrow contains this code:
if (isExpanded) {
btnToggle.setImageDrawable(getResources().getDrawable(
R.drawable.arrow_down));
tvText.setMaxLines(4);
tvText.setEllipsize(TruncateAt.END);
} else {
btnToggle.setImageDrawable(getResources().getDrawable(
R.drawable.arrow_up));
tvText.setMaxLines(Integer.MAX_VALUE);
tvText.setEllipsize(null);
}
isExpanded = !isExpanded;
This code works, but it is not animated. I need to animate the expansion, so the TextView animates to it's full height.
I can't find anything about animating properties like MaxLines. Who can help me out?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…