检测哪些查看您的手指滑过的安卓 [英] Detect which view your finger is sliding over in Android

查看:111
本文介绍了检测哪些查看您的手指滑过的安卓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然类似的<一个href="http://stackoverflow.com/questions/3611338/android-how-to-detect-a-particular-view-has-focus-when-user-swipes-finger-on-sc">questions已被要求在过去,他们似乎没有真正的被回答,这可能是由于混乱,什么被问。

While similar questions have been asked in the past they don't seem to really have been answered which might be due to confusion as to what's being asked.

简单地说,我想检测其观点被输入为你的手指滑过屏幕。这一行动的最好的例子是软键盘上的任何Android手机。当你preSS它显示为一个弹出任意键告诉你的是你的手指在什么样的信。如果你现在移动你的手指在键盘在一个单一的手势的各种字母弹出,当您移动在字母表中的各种字母。

Put simply, I'd like to detect which view is being entered as your finger slides over the screen. The best example of this in action is the soft keyboard on any android phone. When you press any key it shows up as a popup to tell you what letter is under your finger. If you now move your finger over the keyboard in a single gesture the various letters pop up as you move over the various letters of the alphabet.

用什么监听这种类型的行为。我试过OnTouchListeners,但他们似乎只有当你触摸按钮,而不是指过去他们

What listeners are used for this type of behaviour. I've tried OnTouchListeners but they seem to be only when you 'touch' the button as opposed to 'finger past' them

Button button = (Button)findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {doStuff();}
});

button.setOnTouchListener(new OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {
      doStuff();
      return false;
  }
});

OnFocusChangeListener 没有帮助的。

推荐答案

答案很简单,你不能 - 不喜欢iPhone的时候在辅助功能模式

The simple answer is you can't - not like the iPhone when in accessibility mode.

直到冰淇淋三明治是。它现在拥有的能够识别你的手指下的元素,而无需将其对iPhone类似的能力。

Until Ice Cream Sandwich that is. It now has the iPhone-like capability of being able to identify elements under your finger without having to lift it.

这篇关于检测哪些查看您的手指滑过的安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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