安卓:滑动手势和动画选项卡之间切换手势、选项卡、动画

2023-09-06 00:58:21 作者:烂命

我敢肯定,这已经回答了什么地方,已经,但我无法找到它: 我有三个选项卡一个TabHost,每个都包含不同的看法(不活动)。我想要的是从右到左,让当前视图滑出左,从权,从而改变当前选项卡下一个视图幻灯片进行刷卡姿态。所以,我想在标签之间的开关,以通过一个手势(而不是仅通过点击标签上)被触发,也希望显示动画时当前标签被改变。

I'm sure this has been answered somewhere, already, but I just can't find it: I have a TabHost with three tabs, each containing different views (not Activities). What I want is to make a swiping gesture from right to left and let the current view slide out to the left and the next view slide in from the right, thus changing the current tab. So, I want the switch between tabs to be triggered by a gesture (rather than only by clicking on the tab) and also want to show an animation when the current tab is changed.

我看着ViewFlipper示例和教程,但我无法找到一个解释如何做到这一点在标签之间滑动。

I looked at the ViewFlipper examples and tutorials, but I can't find one that explains how to do this to slide between tabs.

再次抱歉如果这之前已经回答了,我只是无法找到它。

Again, sorry if this has been answered before, I just can't find it.

推荐答案

基本手势检测 - 计算器

介绍手势 - 移动TUTS

Introduction to Gestures - mobile tuts

你必须用android的手势工具definde你的手势(你可以找到它的仿真器),并实现了一个手势侦听器来侦听手势事件。

you have to definde your gestures with the android gesture tool (you can find it in the emulator) and implement a gesture listener to listen for gesture events.