开发者

Drop Down Panning Android Fragment Transition

I'm using Android Fragments. I want to achieve the effect below.

I have 2 fragments details and a main-body. On a button click I want the details panel slide down and pan out part of the main-body.

The details panel isn't declared in the activity's xml layout. It is being added dynamically. Also the details panel can be dismissed when the user is done with it.

I found an example of exactly what I want to do. The Gmail app in honeycomb does this when you have it in portrait mode on the Xoom. Navigate all the开发者_运维问答 way to an email such that it is take up the whole screen. Press the back button and notice the email body pans to the right to make room for the email messages list.

Drop Down Panning Android Fragment Transition


The best approach I've currently seen and use (with views but should work for fragments as well) is following: http://udinic.wordpress.com/2011/09/03/expanding-listview-items/

Basically he creates a view with negative margin and then he animates the margin to the desired value. This basically transforms the view properly instead of just doing a simple animation. I'm working on my own implementation that uses height instead of margin.

I'm VERY interested in a better approach. This gets the job done, but I don't like the way its done :)

Edit: I've done it in the following way: https://stackoverflow.com/a/9290723/969325

This is for views but could be used for fragments as well.


Have you looked into using a LayoutTransition?

http://developer.android.com/reference/android/animation/LayoutTransition.html

The default LayoutTransition (when created and enabled) will auto slide child views when new views are added or removed from the parent Layout.

theLayoutView.setLayoutTransition(new LayoutTransition());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜