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?
timstre
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 05, 2010 6:37 pm

Top

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">
  2.  
  3.                         <view class="com.google.android.maps.MapView" android:id="@+id/map"
  4.  
  5.                                         android:layout_width="fill_parent" android:clickable="true"
  6.  
  7.                                         android:apiKey="hdsaf63hksfohnoyoudontdy8hjdhg3y8hjds" android:layout_height="fill_parent"/>
  8.  
  9.                         </LinearLayout>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


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

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests