【发布时间】:2014-11-25 00:29:08
【问题描述】:
我使用 ListView 应用展开动画,
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (interpolatedTime < 1.0f) {
// Calculating the new bottom margin, and setting it
mViewLayoutParams.bottomMargin = mMarginStart
+ (int) ((mMarginEnd - mMarginStart) * interpolatedTime);
// Invalidating the layout, making us seeing the changes we made
mAnimatedView.requestLayout();
// Making sure we didn't run the ending before (it happens!)
} else if (!mWasEndedAlready) {
mViewLayoutParams.bottomMargin = mMarginEnd;
mAnimatedView.requestLayout();
if (mIsVisibleAfter) {
mAnimatedView.setVisibility(View.GONE);
}
mWasEndedAlready = true;
}
}
在这里,当我尝试单击 ListView 的最后一项时,我的 Listview 的最后一项向下扩展,因此,如果不向上滚动,我无法看到最后一项的全部内容。
换句话说,如果我点击最后一项,我希望我的焦点在最后一项的底部(自动滚动),这样我就可以立即看到最后一项的全部内容。
有什么办法可以解决吗?
【问题讨论】: