Is there a way to set a mapview's height?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Is there a way to set a mapview's height?

Postby timstre » Tue Jan 05, 2010 6:42 pm

Hi Forum! =)
I'm quite new to android development.. I want to integrate a mapview in a ui, but I only want it to fill about half the screen's height.. is there any way to do this?
Posts: 2
Joined: Tue Jan 05, 2010 6:37 pm


try this

Postby wizlon » Tue Feb 02, 2010 1:30 pm

I've been wondering about this one too and I've found a way to set the height of a mapview, i haven't got it to play ball fully, but at least it won't try to be the size of the screen.

The way I've done it is placed it inside a linear layout. The height of the map depends on a mixture of how the android:layout_height="fill_parent" is set on both the mapview and the linear layout, for instance to set an absolute height I set the map to be android:layout_height="200px" and left the linear layout as android:layout_height="wrap_content".

This here seems to be keeping my mapview a decent size:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <LinearLayout android:id="@+id/LinearLayout05" android:layout_width="fill_parent" android:layout_height="fill_parent">
  3.                         <view class="" android:id="@+id/map"
  5.                                         android:layout_width="fill_parent" android:clickable="true"
  7.                                         android:apiKey="hdsaf63hksfohnoyoudontdy8hjdhg3y8hjds" android:layout_height="fill_parent"/>
  9.                         </LinearLayout>
Parsed in 0.001 seconds, using GeSHi

Anyway, I hope i've helped.
Junior Developer
Junior Developer
Posts: 23
Joined: Mon Jan 07, 2008 2:17 pm


Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests