Android 元素动画/多个视图之间的转换,而不是活动或片段之间的转换
我是android动画/过渡新手,我想制作一个动画,如下所示: 我应该如何做到这一点 你可以试试Android 元素动画/多个视图之间的转换,而不是活动或片段之间的转换,android,animation,transition,Android,Animation,Transition,我是android动画/过渡新手,我想制作一个动画,如下所示: 我应该如何做到这一点 你可以试试 要进行更深入的学习,请尝试Youtube上的视频教程。您有多种选择: 使用: 您可以使用此库使用两种类型的转换 使用TransitionManager.go。在这个场景中,您应该创建两个场景并在这两个场景之间切换。所有需要的动画将由过渡管理器处理。有关更多信息,请阅读链接 例如: Scene aScene; Scene anotherScene; // Create the scene ro
要进行更深入的学习,请尝试Youtube上的视频教程。您有多种选择: 使用: 您可以使用此库使用两种类型的转换 使用TransitionManager.go。在这个场景中,您应该创建两个场景并在这两个场景之间切换。所有需要的动画将由过渡管理器处理。有关更多信息,请阅读链接 例如:
Scene aScene;
Scene anotherScene;
// Create the scene root for the scenes in this app
sceneRoot = (ViewGroup) findViewById(R.id.scene_root);
// Create the scenes
aScene = Scene.getSceneForLayout(sceneRoot, R.layout.a_scene, this);
anotherScene =
Scene.getSceneForLayout(sceneRoot, R.layout.another_scene, this);
//transition from root scene to another scene
TransitionManager.go(anotherScene);
// Get the root view and create a transition
rootView = (ViewGroup) findViewById(R.id.mainLayout);
mFade = new Fade(Fade.IN);
// Start recording changes to the view hierarchy
TransitionManager.beginDelayedTransition(rootView, mFade);
// change in one of rootView childs
childView.setWidth(100);
// When the system redraws the screen to show this update,
// the framework will animate the addition as a fade in
使用TransitionManager.beginDelayedTransitionrootView。在这种情况下,您可以在参数上设置beginDelayTransition,所有直接子项将在布局属性更改时设置动画。有关详细信息,请阅读链接
例如:
Scene aScene;
Scene anotherScene;
// Create the scene root for the scenes in this app
sceneRoot = (ViewGroup) findViewById(R.id.scene_root);
// Create the scenes
aScene = Scene.getSceneForLayout(sceneRoot, R.layout.a_scene, this);
anotherScene =
Scene.getSceneForLayout(sceneRoot, R.layout.another_scene, this);
//transition from root scene to another scene
TransitionManager.go(anotherScene);
// Get the root view and create a transition
rootView = (ViewGroup) findViewById(R.id.mainLayout);
mFade = new Fade(Fade.IN);
// Start recording changes to the view hierarchy
TransitionManager.beginDelayedTransition(rootView, mFade);
// change in one of rootView childs
childView.setWidth(100);
// When the system redraws the screen to show this update,
// the framework will animate the addition as a fade in
使用欲了解更多信息,请阅读链接。
在您的情况下,您也可以使用viewPager。您可以创建两个片段,第一个使用键盘输入价格,第二个使用输入,其余视图保留在父视图中。然后在点击页眉中的价格时在这两个片段之间切换viewPager,您还需要根据当前片段淡入/淡出页眉价格和取消按钮。您将看到类似于gif的内容。
谢谢你的回答。如何向fragment inside view pager添加转换?以及如何处理片段和父片段之间的通信?