android-maps-v2

How to get Bitmap of MapView from Android Google Maps API V2

别来无恙 提交于 2019-11-30 18:49:15
I'm updating my app to the new Android Maps API V2 and ran into a problem when trying to get a bitmap image of the currently shown map. In API V1 I did this like so: Bitmap mBitmap; MapViwe mMapView; // ... mBitmap = Bitmap.createBitmap(MAP_WIDTH, MAP_HEIGHT, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(mBitmap); mMapView.draw(canvas); Whilest in API V1, this got me a bitmap of the map, in API V2, all I get is a black rectangle. Also with API V2 I'm using the MapView , not the MapFragment so this isn't the problem. GoogleMap.snapshot() method does the job. 来源: https://stackoverflow.com

MapView inside NestedScrollView not scrolling

て烟熏妆下的殇ゞ 提交于 2019-11-30 14:14:53
Inflating my Mapview in xml like this <android.support.v4.widget.NestedScrollView android:id="@+id/sv_offers" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="56dp" android:visibility="gone" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <com.xys.widgets.CustomMapView android:id="@+id/mapView" android:layout_width="match_parent" android:layout_height="125dp"/> </LinearLayout> </android.support.v4.widget

setContentView() slow with map fragment

会有一股神秘感。 提交于 2019-11-30 12:49:36
问题 I am working on an app that shows a google map (api v2) as a fragment. When the app loads it shows a blank white screen for a couple of seconds before showing the map. I have used log statements see where the delays is but I don't know why it's so slow. Here is my onCreate: @Override protected void onCreate(Bundle savedInstanceState) { Log.i(TAG, "onCreate Start -------------------------------"); super.onCreate(savedInstanceState); Log.i(TAG, "onCreate 1 -------------------------------");

Set Image from drawable as marker in Google Map version 2

∥☆過路亽.° 提交于 2019-11-30 10:44:22
问题 I am using this part of code to add a marker in a MapFragment in Google Map Version 2. MarkerOptions op = new MarkerOptions(); op.position(point) .title(Location_ArrayList.get(j).getCity_name()) .snippet(Location_ArrayList.get(j).getVenue_name()) .draggable(true); m = map.addMarker(op); markers.add(m); I want to use different images from my drawable. 回答1: This is how you can set a Drawable as a Marker . BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.current_position

Android GoogleMap 2 update information dynamically in InfoWindow with ImageView via Universal Image loader

删除回忆录丶 提交于 2019-11-30 08:23:51
问题 I am working on new Google Map v2 API. I have used ImageLoader to display images dynamically on Marker. But the problem is when I have got onLoadingComplete() of Universal Image Loader, the ImageView is not invalidated neither automatically nor manually. Next time if I click on the same Marker, image will be displayed from Cache of Universal Image Loader. Below is my CustomInfoWindowAdapter code : private class CustomInfoWindowAdapter implements InfoWindowAdapter { @Override public View

Google Maps Android API v2: My location marker always over other markers?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 07:55:32
Currently migrating an Android app using Google Maps to Google Maps Android v2; I want the map to display the built-in location marker, as well as custom markers. With the previous library, I used to draw the location marker 'below' custom markers, with mapView.setReticleDrawMode(ReticleDrawMode.DRAW_RETICLE_UNDER); I can't find a similar option in the new API. Did I miss something? After a bit a searching, I couldn't find such an option. I finally removed the location pin, and added a similar Marker and Circle to the map; since it is a classic Marker, it appears below the other markers. map

How do you programmatically change the width & height of Google Maps v2 (support Fragment)?

天涯浪子 提交于 2019-11-30 07:53:55
问题 How do you programatically change the width and height of a com.google.android.gms.maps.SupportMapFragment? I'd imagine you might be able to wrap it in a viewgroup with match_parent, but I'm hoping not to nest if I don't have to (honestly not even sure it works). <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/storefront_map" class="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="250dp" /> To give

Clustering map markers on zoom out and unclustering on zoom in

旧巷老猫 提交于 2019-11-30 07:43:11
I am using the Google Map Android clustering Utitlity With Google Maps v2 play services. I am not getting the behavior I expected. As you can see in the two images below, when zoomed in I can see a cluster of 20 and a single marker up an to the left, but when i zoom out til they are on top of each other i am not seeing them cluster.. the 20 cluster still says 20 and not 21? Is that expected behavior? Is there a way can make the cluster show 21 instead of 20+ This is default behavior specified in DefaultClasterRenderer#onBeforeClusterRendered() : /** * Called before the marker for a Cluster is

Maps V2 with viewPager

旧城冷巷雨未停 提交于 2019-11-30 07:24:41
I'm currently developing for Android 4.3. Background: I'm using pageViewer to scroll between three different fragments. My second fragment (tab 2) has XML with SupportMapFragment and other content. as shown below : My problem http://imageupload.co.uk/files/vrhg1e06x977rkm1vhmd.jpg My Attempt: While searching the web I noticed that for SupportMapFragment I need FragmentActivity which doesn't apply for FragmentPagerAdapter. I need the user to have the ability to control the map as well as control the rest of the content in the fragment. My Question: How can I use the SupportMapFragment with the

In Version 2 Map view does not show map

耗尽温柔 提交于 2019-11-30 06:55:56
问题 Map Activity doesn't showing map, it's appear as just white screen with zoom control buttons. Manifest File like this : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.demomap" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <permission android:name="com.example.demomap.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses