简体   繁体   中英

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 ). The problem is it isn't animated like the Google calendar is. 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.

This works in a similar way to viewflipper but is more powerful.

* Update *

There's a new control called View Pager available as a compatibility pack. Check out the new article on Android Developer Blog

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. to swipe to left, you coud start at position 1000 or something. i use that ViewPager, too.

Take a look at this project on github - Greendroid , it is also having the apk in market. You can search in Android market and install it. Look at the pageview control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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