android - Assign Height to GoogleMap in Oncreate method -
bellow code , want assign height google map on oncreate() method.
<fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="450px" android:name="com.google.android.gms.maps.supportmapfragment"/>
fragment map = getfragmentmanager().findfragmentbyid(r.id.map); view mapview = map.getview(); int widthmeasurespec = measurespec.makemeasurespec(*some width*, measurespec.exactly); int heightmeasurespec = measurespec.makemeasurespec(*some height*, measurespec.exactly); mapview.measure(widthmeasurespec, heightmeasurespec); int height = mapview.getmeasuredheight(); the width , height can specific px or layoutparams.wrap_content/match_parent.
more info can found here: http://developer.android.com/reference/android/view/view.html#layout
Comments
Post a Comment