我尝试过以下代码:
final View v = txt; //txt is my textview
Animation anim = new Animation() {
protected void applyTransformation(float interpolatedTime, Transformation animLinear) {
super.applyTransformation(interpolatedTime, animLinear);
// Do relevant calculations here using the interpolatedTime that
// runs from 0 to 1
v.setLayoutParams(new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, (int) (500 * interpolatedTime)));
}
};
anim.setDuration(1500);
v.startAnimation(anim);
沿着视图向下显示布局。我想要一个类似的效果,但反过来。简而言之,我想展示一个动画,其中TextView
从下到上逐行隐藏。我不想要滑动效果。我想逐行隐藏一个视图。
答案 0 :(得分:1)
在Xml中使用此代码
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0" />