我想切換使用動畫的活動.. 我有一個視圖與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);
}
}
};
和我的動畫文件 fade_in:
<?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" />
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="1.0" android:toAlpha="0.0"
android:fillAfter="true"
android:duration="500" />
現在我的問題是活動之間切換時,動畫有沒有影響真正的設備,但工作在模擬器....我提到堆棧溢出和谷歌搜索,但無法找到爲什麼動畫不工作.. 我嘗試過使用各種類型的動畫,例如slide_in_left,right,top,bottom ... 但動畫無效。幫我解決這個問題。預先感謝。
看看是否有幫助http://stackoverflow.com/questions/11364714/overridependingtransition-doesnt-work – pskink
嘗試從清單文件中的活動中刪除主題。 –
我沒有在我的清單文件中添加任何主題。 – AndroidOptimist