我有一个在带有两个窗格的平板电脑设备上运行的应用程序,对于左侧,我有一个替换片段的简单动画:
private void loadLeftFragment(Fragment fragment, boolean isAnimated) {
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
if (isAnimated) {
fragmentTransaction.setCustomAnimations(android.R.anim.slide_in_left,
android.R.anim.slide_out_right);
}
fragmentTransaction.addToBackStack(null);
fragmentTransaction.replace(R.id.left_frame, fragment).commit();
}
请注意代码的动画和平。它在 Nexus 7 上运行非常流畅,但在 Galaxy Tab 2 上却不是。所以我android:hardwareAccelerated="true/false"
在 AndroidManifest.xml 中尝试了标签。我得到的是,当false
Galaxy Tab 2 上的值设置为动画时,例如在 Nexus 7 上,即流畅且美观。假设反之亦然,我没想到会出现这种行为-将hardwareAccelerated
值设置为true
使事情“更顺畅”。但是如果我将它设置为true
我看到滞后,它就会发生,当false
它很好时!我在这里缺少什么?谢谢你。