Titanium Mobile:滑动切换视图
我正在使用 Titanium 开发一个移动应用程序。我遇到了 Android 版 Google Plus、Tweetdeck、Market Apps。要在选项卡之间切换,他们使用滑动手势。就像下一个视图只是根据您的滑动/拖动滑入一样。我还想为我的应用程序添加相同类型的行为,我希望它能够在 Android 和 iOS 平台上运行。我怎样才能拥有它? 我尝试过 Ti.UI.scrollableView。我面临的问题是
滑动的响应速度不如上述应用程序中的响应速度。
视图不随着手指拖动而移动。手指拖动完成后它会移动。
由于应用程序响应急剧减慢并且动画看起来不平滑,因此似乎需要更多内存。
请告诉我是否有任何其他替代方案可以在应用程序中实现这种体验。 谢谢!!
I am developing a mobile app using Titanium. I came across the Google Plus, Tweetdeck, Market Apps for Android. To switch between the tabs they use the slide gesture. Its like the next view simply slides in based on your swipe/drag. I would also like to add the same kind to behavior for my app I would like to have it work on both Android and iOS platforms. How can I have it?
I have tried Ti.UI.scrollableView. The problems I faced were
The sliding was not as responsive as seen in the above apps.
The view does not move along with the finger drag. It moves after the finger drag is finished.
It seems to take more memory as the application response slows drastically and animations dont appear to be smooth.
Kindly let me know if there is any other alternative to implement this kind of experience in the app.
Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您基本上需要的是一个实现原生 Android ViewPager 的 Ti.UI.ScrollableView。这些其他应用程序将其选项卡绑定到 ViewPager。您无法使用 Ti.UI.TabGroup 执行此操作,但您可以使用自己的选项卡视图或提供此功能的其他模块,例如 这个。您还可以在此处查看我的 Alloy 小部件 - 它为 Ti.UI 提供了自定义选项卡指示器.ScrollableView(没有其他模块)。
What you basically need is a Ti.UI.ScrollableView which implements the native Android ViewPager. Those other Apps are binding their Tabs to the ViewPager. You can't do this with a Ti.UI.TabGroup but you can either use your own Tab views or some other module that provides this functionality like this. You could also have a look at my Alloy widget here - it provides a custom tab-indicator for Ti.UI.ScrollableView (without another module).
对于 Android,您应该考虑使用第三方库来实现此类功能。
就我个人而言,我使用 PagerSlidingTabStrip 我发现它效果非常好。
For Android you should consider using a third-party library to implement such functionality.
Personally I use PagerSlidingTabStrip which I have found that works really well.