3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

TouchSlopを取得する

Last updated at Posted at 2014-08-15

slopは直訳すると「こぼれ水」とか「ぬかるみ」。

int slop = ViewConfigration.get(this).getScaledTouchSlop();

タッチで差分があったときに、slop以上の場合はイベント発火するで!みたいな使い方をします。(16dpとか固定値でもいいと思いますが。)

具体的な例としてはViewPagerで横スライドするときの判定で使われてます。
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.1_r1/android/support/v4/view/ViewPager.java

ちなみにViewConfigrationにはオーバースクロールやダブルタップのSlop取得とか色々ある。端末毎の差異は困るときが訪れたら調べる。
http://developer.android.com/reference/android/view/ViewConfiguration.html

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?