'getHitRect'에 해당되는 글 1건

  1. 2012.10.16 Adjusting Touch Area

Adjusting Touch Area

Android 2012. 10. 16. 17:56

터치를 View 기준 또는 터치된 위치를 계산하여 지나치게 정확한 좌표를 대조하다보니,

섬세한 동작이 필요 없는 경우에도 터치가 안먹는 듯한 느낌이 드는 경우가 생김.

 

그래서 섬세한 좌표 대조가 필요하지 않은 경우 터치 영역을 소량 늘려서 터치 인식이 더욱 잘 되는것 처럼 느끼게 한다.

아래는 관련 글, 원리는 간단. 인식 범위를 조금 넓혀준 것 뿐이다.

 

아래 글을 죽 읽다보면 이런 글이 나온다.

 

 Unfortunately, overriding getHitRect() does not work in ICS. getHitRect is no longer called in ViewGroup’s dispatchTouchEvent as it is in pre-ICS dispatchTouchEvent. In ICS a new method isTransformedTouchPointInView() is used to determine whether to pass a MotionEvent to a child view. This method determines that by passing coordinates to each child’s pointInView() method. pointInView() is a final method, so we unfortunately cannot override it.

...

 

ICS 부터는 getHitRect() 를 오버라이딩해도 동작하지 않아 위 문장 아래에서 대체 방안을 설명하고 있으니 참고.

 

http://www.brendanweinstein.me/2012/06/26/touchdelegate-and-gethitrect-making-buttons-with-expanded-touch-areas/

'Android' 카테고리의 다른 글

Open GL ES 1.1 for Android  (0) 2012.10.25
Android GestureDetector  (0) 2012.10.18
Android GCM 가이드 따라하다 삽질한 기억  (0) 2012.10.09
Custom dialog 위치/크기 변경하기  (1) 2012.09.26
Avoding memory leaks  (0) 2012.09.10
Posted by 독뽀
,