相关疑难解决方法(0)

片段标准转换不是动画

我正在使用v4 android兼容性库来开发平板电脑用户界面,使用专门针对Android 2.2设备的片段.

一切都按照预期的方式工作,除了我无法使任何动画工作,甚至标准动画都没有.

码:

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();
Run Code Online (Sandbox Code Playgroud)

片段冻结大约一秒钟而不是使用过渡动画,而刚刚消失并出现新的片段.

使用:

ft.setCustomAnimations(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
Run Code Online (Sandbox Code Playgroud)

也不起作用.

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>
Run Code Online (Sandbox Code Playgroud)

我读到自定义动画在兼容性库中被破坏了,但似乎没有人遇到标准转换的问题.我已经在3.2.1摩托罗拉Xoom,2.3 Galaxy Tab 7",2.2仿真器,甚至在2.4.4的HTC G2上进行了测试.

这可能有什么问题?

animation android android-fragments android-support-library

45
推荐指数
3
解决办法
4万
查看次数