0

Ok, the title is messy but here's the concept.

When the Activity starts it would look like this: Start

If you keep pulling down when the ListView reaches top the Map will get bigger, like this: ListView bottom

But if you scroll down in the ListView the Map will become smaller, like this: Map top

Now is this possible on Android. Thanks for any response :D

MeIsOlsson
  • 165
  • 1
  • 3
  • 9

2 Answers2

0

In a manner this is possible. The way you do it would be to first determine the direction of the user swipe. You could place your list view and map in two separate fragments and then determine the user swipe on either fragment by adding in a SimpleOnGestureListener (for your purposes, you would be dealing with a vertical swipe).

Then you would programmatically set the weight of the fragment to become bigger/smaller as the case may be. Since your list and map would be in two separate containers (which could be fragments, LinearLayout, RelativeLayout, etc..) I would need more details before I say for certain you proceed in this manner. But to answer your question, yes it is possible. I would suggest you look into the following two links to get a better idea and then determine how to proceed (it might not be the same as your case but you would at least get the general idea):

How to detect swipe direction between left/right and up/down

How to add Action bar options menu in Android Fragments

Community
  • 1
  • 1
ucsunil
  • 7,378
  • 1
  • 27
  • 32
0

You could certainly change the map size as you scroll the list, though I think the performance would not be great. Google maps generally take a while to render and you have no real control over it. If you want to go this route, try setting new LayoutParams on the map view.

Another option would be to replace the map with an ImageView. The maps api supports this with the snapshot() method. You would then want to seamlessly replace the map with the image as you scroll.

A third option is what Google maps does. Basically, you have a map that fills the screen, then a sliding layout that comes up from the bottom and covers the map. This drawer slides up and then the map re-centers so that whatever portion is visible shows the marker. This would probably have the best performance of any option.

Jason
  • 1,418
  • 2
  • 13
  • 10