Google Plus tile animation

纵然是瞬间 提交于 2019-12-04 07:46:27

问题


I'm trying to figure out how I could make a similar layout as in Google plus timeline view. There's an animation while scrolling in timeline and I really like it. Any idea how to do that?


回答1:


You need to set a TranslateAnimation to the view and that would do the trick for you.

TranslateAnimation translateAnim = new TranslateAnimation(200, 0, 0, 0 );
//Use (0, 0, 200, 0 ) if you would like to animate this in a mobile device rather than a tab
listView.clearAnimation();
translateAnim.setDuration(500);   
translateAnim.setFillBefore(true);   
listView.startAnimation(translateAnim);

Hope this helps :)




回答2:


I would check out the carousel example code provide by google http://code.google.com/p/renderscript-examples/wiki/Carousel

Essentially what this does is creates a series of tiles that can be textured by any image you please. The code is set up out of the box to do a cylindrical carousel from the outside but you can move the view point and even make it flat as in the g+ example if you so chose.

A note of caution, as of Jellybean (4.1) Google has deprecated the graphics components of renderscript. We have begun the process of moving everything over from renderscript to openGL at our company, so be sure to evaluate if making new code with a deprecated API makes sense for you particular usage.



来源:https://stackoverflow.com/questions/12109942/google-plus-tile-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!