我使用的V4的Android兼容性庫開發使用片段專爲Android 2.2設備和一個平板UI。片段標準過渡不動畫
一切工作,因爲它應該,但我不能讓任何動畫的工作,甚至沒有標準的動畫。
代碼:
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ABCFragment abcFragment = new ABCFragment();
ft.replace(R.id.main_frame_layout_fragment_holder,abcFragment);
ft.addToBackStack(null);
ft.commit();
使用公交動畫代替,片段凍結約一秒鐘,剛剛消失,新出現一個。
使用:
ft.setCustomAnimations(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
也不起作用。
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.synergygb.mycustomapp"
android:id="@+id/LinearLayout01" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:gravity="bottom">
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/main_frame_layout_fragment_holder">
</FrameLayout>
<!-- OTHER FIXED UI ELEMENTS-->
</RelativeLayout>
我讀的是自定義動畫是在兼容性庫打破,但似乎沒有人是具有與標準過渡的問題。我已經在3.2.1摩托羅拉XOOM,2.3的Galaxy Tab 7" ,2.2模擬器進行了測試,甚至在同一個2.3.4 HTC G2。
出了什麼問題嗎?
達爾維克(調試器)給你什麼? – IAmYourFaja
你有任何logcat輸出給我們嗎? –
沒什麼,這就是爲什麼我輸了。沒有錯誤。 Logcat什麼也沒有顯示。只需定期回調系統,與應用內更改無關。 檢查mTransition的值= 4099. 該值由以下項設置: ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); – blindstuff