轻扫在Android上切换标签,就像在YouTube /谷歌音乐应用 [英] Swipe to switch tabs on Android, like the YouTube/Google Music apps

查看:139
本文介绍了轻扫在Android上切换标签,就像在YouTube /谷歌音乐应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在他们最新的他们的应用程序的版本,谷歌已经实施的标签与点击标签头之间刷卡的pretty的冷静的方式。我想知道,如果有人有如何做到这一点更具体的想法。

In their latest versions of their apps, Google has implemented a pretty cool way of swiping between tabs versus clicking tab headers. I was wondering if someone has more concrete ideas of how this is done.

下面是一些想法 - 随意批评:

Here are some thoughts - feel free to critique:

我最初的想法是,这是不是一个标准的 TabActivity 承载子活动。逸岸,我甚至不认为这是一个自定义的的ActivityGroup 无论是。当刷卡标签涡旋的行,但不会引起活性选项卡切换。

My initial thought is that this isn't a standard TabActivity which hosts child activities. Infact, I don't even think it's a custom ActivityGroup either. The row of tabs scrolls when swiped, but doesn't cause the active tab to switch.

刷卡标签的主要内容表现出有趣的现象。我怀疑有连接到主要内容区GestureListener。作为选项卡刷卡,从相邻的标签行变得可见。这似乎表明,这是的ListView S的水平滚动组。这几乎就像一个水平滚动的HTML DIV,其中所有内容已经存在,但映入眼帘的刷卡时。我真的不知道怎么行渲染(滚动列表向上/向下不左/右,当传统,行生成和显示)的处理虽然。所以,也许这是一个自定义的的ListView 的实施呢?当不滚动一侧到另一侧,它的行为,你会期望一个普通的的ListView 来,包括快速滚动和发光效果时,拉下来。

Swiping the main content of the tab exhibits interesting behavior. I suspect there is a GestureListener attached to main content area. As tabs are swiped, rows from the adjacent tab become visible. This seems to suggest that this is a horizontally scrollable group of ListViews. It's almost like a horizontally scrollable HTML div, where all content already exists but comes into view when swiped. I'm not really sure how rendering of the rows is handled though (traditionally, rows are built and displayed when scrolling a list up/down not left/right). So maybe it's a custom ListView implementation too? When not scrolling side-to-side, it behaves as you would expect a regular ListView to, including fast-scrolling and glow effect when pulled down.

标签的行可能是滚动型时,在刷卡的边缘就证明了光晕效果。的标签内容的行不。

The row of tabs is probably a ScrollView, as evidenced by the glow effect when swiped to the edges. The row of the tab contents isn't.

我试图建立不同的部分组成这真是一件漂亮的用户界面的心理模型。任何见解是多少AP preciated。

I'm trying to build a mental model of the different pieces that comprise this really nifty piece of UI. Any insights are much appreciated.

推荐答案

信息是最宝贵的资源如何完美地做到这一点是从的 IO 2011应用

the most valuable source of information how to do it perfectly is a source from IO 2011 application

。看看ScheduleFragment和工作区的类。

Look into ScheduleFragment and Workspace classes.

感谢。

这篇关于轻扫在Android上切换标签,就像在YouTube /谷歌音乐应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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