检测左右滑动android?

时间:2013-09-13 17:20:05

标签: android

我的RelativeLayout定义如下:

<RelativeLayot>

  <TextView />
  <TextView />
  <EditText />
  <Button />

</RelativeLayout

我想检测此RelativeLayout左侧或右侧的滑动,并使用新文本更新两个textviews。这样做的最简单或最有效的方法是什么?任何帮助表示赞赏。

2 个答案:

答案 0 :(得分:1)

要检测向左或向右滑动,我们在Android中使用Gesture。请仔细阅读以下链接,向您展示可以捕获的各种手势。

http://developer.android.com/design/patterns/gestures.html http://www.vogella.com/articles/AndroidGestures/article.html

答案 1 :(得分:0)

使用手势叠加来检测滑动。您可以通过手势生成器创建左右滑动。请参阅此链接http://www.vogella.com/articles/AndroidGestures/article.html或此Using a gesture overlay view in android。开发人员文档http://developer.android.com/reference/android/gesture/GestureOverlayView.html

相关问题