I checked out your code,and run ,finally found it didn't work(collapse).After debug it ,I found the height is not correct(mCollapsedHeight).here is my solution.
problem code:
if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), mCollapsedHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); }
//////////////////////////
solution:
if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), oldHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); oldHeight = getHeight (); }
I checked out your code,and run ,finally found it didn't work(collapse).After debug it ,I found the height is not correct(mCollapsedHeight).here is my solution.
problem code:
if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), mCollapsedHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); }
////////////////////////// solution:if (mCollapsed) { animation = new ExpandCollapseAnimation(this, getHeight(), oldHeight); } else { animation = new ExpandCollapseAnimation(this, getHeight(), getHeight() + mTextHeightWithMaxLines - mTv.getHeight()); oldHeight = getHeight (); }