开发者

How to animate the view changes given unlimited views

开发者 https://www.devze.com 2023-03-28 06:06 出处:网络
I have an app that needs to display an agenda for the user. I have it set up so that your daysare switched as you swipe left and right (via GestureSensor). The problem is it isn\'t animated like the G

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 开发者_JAVA百科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


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.


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.

0

精彩评论

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