1

I've added a Map from google play services as a headerview of my listview. However, when trying to pan on the map, the list immediately takes over and starts scrolling up and down. If the user intents to pan the map(e.g. he starts a touch event on the maps surface) it should block the listview from handling the input. How do i achieve this?

note: when starting a touch on the listview, it should still scroll as a normal listview :)

Oht
  • 409
  • 5
  • 19
  • set OnTouchListener on your view containing the map. When you detect that user touched it, call requestDisallowInterceptTouchEvent(true) on that view http://developer.android.com/reference/android/view/ViewParent.html#requestDisallowInterceptTouchEvent(boolean) – Tomislav Novoselec Jan 07 '15 at 09:17
  • Ive tried that, but i've noticed that it will not always fire. only if i click on the padding border of the map, i think google maps blocks this. – Oht Jan 07 '15 at 09:49
  • http://stackoverflow.com/questions/16974983/google-maps-api-v2-supportmapfragment-inside-scrollview-users-cannot-scroll-th Solved it by overiding the listview :) – Oht Jan 08 '15 at 08:10

1 Answers1

0

I think you can try to use a static(fixed) header view, so touching your header view wont scroll your listview.

Also, I think putting a Google Map inside a header view is not really a good practice. I think a better practice is to put a MapFragment on top, then put listview below the MapFragment

ztan
  • 6,861
  • 2
  • 24
  • 44
  • I would like to scroll the map out of view when scrolling the listview, thats why its IN the listview – Oht Jan 08 '15 at 07:39