【发布时间】:2013-11-01 08:58:45
【问题描述】:
我想用动画切换活动.. 我有一个包含 5 个图像的视图,并且我设置了我的 oncliclk 侦听器。 我的主要活动是
private View.OnClickListener onClickListener = new View.OnClickListener()
{
public void onClick(View testView)
{
if (testView == Main.this.myinput)
{
Intent i = new Intent(Main.this, Activity1.class);
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
if (testView == Main.this.myinput)
{
Intent i = new Intent(Main.this, Activity2.class);
startActivity(i);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
}
};
我的动画文件是 淡入:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="500" />
淡出:
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500" />
现在我的问题是在活动之间切换时,动画对真实设备没有影响,但它在模拟器上运行......我提到了堆栈溢出和谷歌搜索但找不到动画为什么不起作用...... 我尝试了各种类型的动画,例如slide_in_left,right,top,bottom ... 但动画不起作用。帮我解决这个问题。在此先感谢..
【问题讨论】:
-
尝试从清单文件中的活动中删除主题。
-
我没有在清单文件中添加任何主题..
-
你检查过动画设置吗?
-
是的,我做到了……让我再检查一遍……
标签: android animation android-animation