一切都按照预期工作,除了我无法使任何动画效果工作,甚至标准动画也不行。
代码:
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上进行了测试。
这里可能出了什么问题?