사용자 정의 어댑터가있는 ExpandableListView
이 있고 제스처 탐지기에 의해 선택한 목록 항목을 찾는 방법을 찾는 중입니다. 제스처. 7 = itemNum이 경우MotionEvent를 위치로 변환 한 후 확장 가능한 목록보기에서 참조 된 목록 항목을 확인하는 방법
class MyGestureDetector extends SimpleOnGestureListener {
@Override
public void onLongPress(MotionEvent e) {
int itemnum = listView.pointToPosition((int) e.getX(), (int) e.getY());
itemnum -= listView.getFirstVisiblePosition();
그래서, B 그룹이 축소 된 경우
group A label
group B label
item B1
item B2
group C label
item C1
item C2
item C3 <== this is position 7, assuming group A label was still on the screen
그래서 다음 itemNum이 7 C5 또는 D1이 될 것 일 수있다.
특정 위치 번호가 주어지면 어떤 그룹 위치와 그 위치를 가리키는 지 어떻게 결정합니까?
어떤 그룹이 확장되었는지 알았다면 각 항목을 세어 루프 할 수 있었지만 목록이 스크롤 된 경우 이전 항목은 계산되지 않아야합니다.
ExpandableListView
에 MotionEvent
이 주어 졌으므로 어떻게 대응했는지 View
으로 변환합니까?