简体   繁体   English

如何在给定无限视图的情况下为视图更改设置动画

[英]How to animate the view changes given unlimited views

I have an app that needs to display an agenda for the user.我有一个需要为用户显示议程的应用程序。 I have it set up so that your days are switched as you swipe left and right (via GestureSensor ).我进行了设置,以便在您左右滑动时切换您的日子(通过GestureSensor )。 The problem is it isn't animated like the Google calendar is.问题是它不像 Google 日历那样具有动画效果。 I have done some research into View switchers and such, but they all seem to require a finite number of views.我对视图切换器等进行了一些研究,但它们似乎都需要有限数量的视图。 The Google Calendar does it with unlimited switches of the dates so this must be possible.谷歌日历可以无限切换日期,所以这必须是可能的。

Can anyone point me in the right direction as to how to create an animated change of views (and the ability to see the views move with your movements) for unlimited dates.任何人都可以为我指出正确的方向,即如何创建无限日期的动画视图更改(以及查看视图随您的动作移动的能力)。 I have some theories and would love some feedback.我有一些理论,希望得到一些反馈。

You can use the ViewAnimator class.您可以使用ViewAnimator class。

This works in a similar way to viewflipper but is more powerful.这与 viewflipper 的工作方式类似,但功能更强大。

* Update * * 更新 *

There's a new control called View Pager available as a compatibility pack.有一个名为 View Pager 的新控件可用作兼容包。 Check out the new article on Android Developer Blog查看关于 Android 开发者博客的新文章

You can use the ViewPager for that, but you have to increase the getCount() result +1 if you get to position getCount -1, then you are able to swipe to right indefinitely.您可以使用 ViewPager,但如果您到达 position getCount -1,则必须增加 getCount() 结果 +1,然后您可以无限向右滑动。 to swipe to left, you coud start at position 1000 or something.要向左滑动,您可以从 position 1000 或其他东西开始。 i use that ViewPager, too.我也使用那个 ViewPager。

Take a look at this project on github - Greendroid , it is also having the apk in market.看看 github - Greendroid上的这个项目,它也有市场上的 apk。 You can search in Android market and install it.您可以在 Android 市场中搜索并安装它。 Look at the pageview control.查看浏览量控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM