我正在将片段A替换为片段B并进行动画处理。片段B具有一个带有
TextView
和ListView
的RelativeLayout
。我所看到的是,片段B中的视图被分别动画化,TextView
的滑动速度与列表项1的副标题不同,而列表项1的标题和图标则立即出现而没有动画,我想让整个视图同时动画,这可能实现吗? FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment existing = fragmentManager.findFragmentById(R.id.welcome_content);
if (existing != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
fragmentToLoad.setAllowEnterTransitionOverlap(true);
fragmentToLoad.setEnterTransition(new Slide(Gravity.RIGHT));
}
fragmentTransaction.remove(existing);
}
fragmentTransaction.add(R.id.welcome_content, fragmentToLoad);
fragmentTransaction.commitNow();