我正在尝试为片段制作动画但是当我运行app并使用动画时,我得到Unhandled exception
:
Java.Lang.RuntimeExeption:未知的动画师名称:alpha
我的代码是:
private void ShowFragment(Android.App.Fragment fragment)
{
var trans = FragmentManager.BeginTransaction();
// this line below set an animation
trans.SetCustomAnimations(Resource.Animation.frag_slide_in, Resource.Animation.frag_slide_out);
trans.Hide(mCurrentFragment);
trans.Show(fragment);
trans.AddToBackStack(null);
trans.Commit();
mStackFragment.Push(mCurrentFragment);
mCurrentFragment = fragment;
}
但我的anim
看起来很清楚
frag_slide_in:
<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/bounce">
<translate
android:fromYDelta="-100%"
android:toYDelta="0"
android:duration="1000"
android:startOffset="500" />
<alpha
android:fromAlpha="0.3"
android:toAlpha="1.0"
android:duration="1000"
android:startOffset="500" />
</set>
frag_slide_out
<?xml version="1.0" encoding="UTF-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:interpolator/anticipate">
<translate
android:fromXDelta="0"
android:toXDelta="100%"
android:duration="650"/>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.5"
android:duration="650"/>
</set>
问题出在哪里?