How to create the layout and transitions like the android 3 email app?
I'm trying to find a way to build a layout like the android 3 email app with the same transitions when switching from the folder view to a specific email.
------------------------------ ------------------------------
| View 1 | View 2 | | View 2 | View 3 |
| | | | | |
| | | --> | | |
| | | | | |
| | | | | |
------------------------------ ------------------------------
If the user clicks an entry in view 2,开发者_开发问答 view 1 should slide out to the left and view 3 should slide in from the right. view 2 has to be moved to the left and resized. In the android mail app it seem as if the whole page slides in from the right. the fading makes the effect as if the view 2 is moving.
I tried it with 3 fragments but had no success to create/apply the animations correctly.
The second version was build with 2 activities, but the transitions didn't look like expected. The title bar was animated too.
Any idea which layout would be the best? How to apply the required animations?
Edit: Current solution: I have 3 fragments in the layout. view 3 is hidden on startup.
On click on view 2:
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.hide( view1);
transaction.show( view3);
transaction.setTransition( FragmentTransaction.TRANSIT_NONE );
transaction.commit();
The only problem is, that view 3 is animated from the upper left corner when shown the first time and all hidden/show fragments are faded out/in. Where can I switch these animations off?
The best way seems to use 2 activities with the layouts designed above. A fade and slide transition for the activities creates the same visual effect.
精彩评论