视图之间的水平“选项卡"式滚动 [英] Horizontal "tab"ish scroll between views

查看:20
本文介绍了视图之间的水平“选项卡"式滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣创建一个对齐"到查看项目的水平滚动视图,因此一次只显示一个项目.用户可以向左/向右触摸拖动,将看到上一个/下一个视图,如果有足够的速度,则切换到它.这种交互与 Nexus One 附带的新天气/新闻小部件在其选项卡"之间导航时所做的完全一样.

I'm interested in creating a horizontal scroll view that "snaps" to the viewed item, so only one item is ever shown at a time. The user can touch-drag left/right and will see previous/next views, switching to it if there's enough velocity. This interaction is exactly like what the new weather/news widget that comes with the Nexus One does for navigating between its "tabs".

是否有任何现有的视图小部件可以执行此操作?

Are there any existing view widgets that do this?

更新:找到了一份新闻/天气小部件 (GenieWidget) 的副本,他们似乎已经实现了自己的小部件来实现这一点,他们称之为 com.google.android.apps.genie.geniewidget.ui.FlingableLinearLayout 这是他们自己的自定义 com.google.android.apps.genie.geniewidget.ui.TabView 的一部分.由于该来源不可用,因此方向看起来不太乐观.

Update: found a copy of the news/weather widget (GenieWidget) and they seem to have implemented their own widget to accomplish this which they call com.google.android.apps.genie.geniewidget.ui.FlingableLinearLayout which is part of their own custom com.google.android.apps.genie.geniewidget.ui.TabView. As that source isn't available, that's not looking too hopeful a direction.

推荐答案

(更新 20110905:官方 android 工具现在做得更好)

(update 20110905: Official android tools now do this better)

我克隆了 Eric Taix 的 http://code.google.com/p/andro-views/ 在 github 上

I cloned Eric Taix's http://code.google.com/p/andro-views/ on github

https://github.com/olibye/AndroViews

然后应用上面的补丁:

  • JonO 的补丁

  • JonO's patch

Tom de Waard 的补丁

Tom de Waard's patch

拆分成一个库和一个示例,允许简单地包含在其他项目中

Split into a library and an example, allowing simple inclusion in other projects

我会在上面发表此评论,但我似乎无法对 JonO 的回答发表评论

I would have made this comment above, however I didn't appear able to comment on JonO's answer

这篇关于视图之间的水平“选项卡"式滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆