如何结合 XML 动画做以下效果:
1 -> 2(在 TextView 中淡入时滑入)
我的部分 XML 代码是:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1" >
<TextView
android:id="@+id/tvData"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="TYPE:"
android:gravity="center"
android:textStyle="bold"
android:textSize="@dimen/info_height"
android:shadowDx="4"
android:shadowDy="4"
android:shadowColor="#A7A7A7"
android:shadowRadius="15" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="@dimen/about_divider_height" >
<TextView
android:id="@+id/tvBloodDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/roundtv"
android:text=""
android:gravity="center"
android:textSize="@dimen/btn_text"
android:textStyle="bold"
android:shadowDx="8"
android:shadowDy="8"
android:shadowColor="#CC900205"
android:shadowRadius="25"
android:textColor="#FFFFFF"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
Java的一部分:
private Runnable task = new Runnable() {
public void run() {
//run the animated task
tvB.setAnimation(animationTranslateIn);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bloodtype);
tvB = (TextView) findViewById(R.id.tvBloodDetail);
animationTranslateIn = AnimationUtils.loadAnimation(BloodType.this, R.anim.slideanim);
}
我有幻灯片动画 xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:shareInterpolator="true">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.1"
android:duration="200"
android:repeatCount="1"
android:repeatMode="reverse"
android:startOffset="0" />
<translate android:duration="2000"
android:fromXDelta="0"
android:toXDelta="100%p"
android:startOffset="0" />
</set>
我如何将上述两者结合起来,甚至以不同的方式来遵循与 1 和 2 相同的过程?