天道酬勤,学无止境

android-mapview

How can I remove the shadow on the markers on my map?

问题 @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); // ---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(geoPnt, screenPts); // ---add the marker--- /*Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 67, null);*/ return true; } } 回答1 在调用重写方法时,我会尝试为shadow参数传递false 。 这意味着它应该看起来像super.draw(canvas, mapView, false) 。 回答2 @Override public boolean draw(Canvas canvas, MapView mapView

2022-05-16 01:19:08    分类:技术分享    java   android   google-maps   overlay   android-mapview

How to add touch event to show latitude and longitude in a toast in OSM

问题 public boolean onTouchEvent(MotionEvent event, MapView mapView) { if (event.getAction() == 1) { GeoPoint geopoint = (GeoPoint) mapView.getProjection().fromPixels((int) event.getX(), (int) event.getY()); // latitude double lat = geopoint.getLatitudeE6() / 1E6; // longitude double lon = geopoint.getLongitudeE6() / 1E6; Toast.makeText(context, "Lat: " + lat + ", Lon: "+lon, Toast.LENGTH_SHORT).show(); } return false; } 回答1 使用这段代码并创建一个此类的对象并将其添加到 mapsOverlay class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow

2022-05-04 15:47:43    分类:技术分享    android   android-mapview   android-gesture

Tutorial — Android Map Pin drop animation — Working right [closed]

问题 很难说这里问的是什么。 这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。 如需帮助澄清此问题以便重新打开它,请访问帮助中心。 9 年前关闭。 我需要我的 android 应用程序的地图图钉放置动画。 做了很多研究,我发现没有任何用处。 所以我创建了一个小技巧。 只需发布代码,以便其他人可以使用它并相应地修改它。 由于 android 中的翻译动画仅适用于视图,而叠加层不是视图,因此我创建了一个小技巧,通过翻译动画将视图放置在同一地理位置,然后删除视图以显示叠加层。 通过这种方式,用户认为地图叠加层正在从顶部下降,即使它们不是。 这是代码: private void translateAnimation(MapView mapView,ArrayList<GeoPoint> geoPointsList,Context context) { Point dropPoint = new Point(); Projection projection = mapView.getProjection(); /* * Getting the map projections to calculate * screen points and geopoints */ GeoPoint mGeoPoint = projection.fromPixels

2022-05-03 14:59:17    分类:技术分享    android   overlay   android-mapview   android-animation

Android draw route on a Mapview with twoo POI-s

问题 回答1 通过这些代码。 根据您的要求修改代码 MapDirection.java: public class MapDirection extends MapActivity{ MapView mapview; MapRouteOverlay mapoverlay; Context _context; List<Overlay> maplistoverlay; Drawable drawable,drawable2; MapOverlay mapoverlay2,mapoverlay3; GeoPoint srcpoint,destpoint; Overlay overlayitem; public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); setContentView(R.layout.map_direction); RegisterActivities.registerActivity(this); mapview=(MapView

2022-05-02 08:18:11    分类:技术分享    android   android-mapview

How can I add a TextView below a MapView?

问题 我关注了 Hello Views, Google Map View,现在我想在MapView下面添加一个TextView 。 我只更改了布局文件main.xml并将MapView和TextView放在垂直LinearLayout中。 我的 Eclipse 设置为自动构建它,但是当我在模拟器中运行应用程序时,我只能看到MapView 。 如何在MapView下方添加TextView ? 这是我的布局main.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey=

2022-04-29 10:09:19    分类:技术分享    android   layout   android-mapview   android-linearlayout

MapView rendering with tiles missing with an "x" in the center

This is very, very strange. I've never seen anything like it. At the time I am took this screenshot, I'm not loading any overlays. First, I thought it was my internet connection where it couldn't download the tile information; but we have many users reporting the same issue who downloaded from the market. This just started happening like a week ago. Not sure why though. Anyone have a clue? Thanks!

2022-04-29 09:45:38    分类:问答    android   android-mapview

android mapview not working

This is killing me!!! I seem to have done all I need to do but it just wont work! here is what i did: -created a keystore using keytool: $ keytool -genkey -v -keystore PADReleaseKey.keystore -alias pocket_aces_release -keyalg RSA -keysize 2048 -validity 10000 -got the MD5 fingerpring from it and used: $ keytool -list -alias pocket_aces_release PADReleaseKey.keystore -used it to get the mapAPI key and embedded it inside my application: <com.google.android.maps.MapView android:layout_weight="1" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent"

2022-04-29 04:31:18    分类:问答    android   google-maps   google-maps-api-3   android-mapview   self-signed

Android, How to remove all markers from Google Map V2?

I have map view in my fragment. I need to refresh map and add different markers based on condition. So, I should remove last markers from map before add new markers. Actually, some weeks ago app was working fine and suddenly it happened. My code is like this: private void displayData(final List<Venue> venueList) { // Removes all markers, overlays, and polylines from the map. googleMap.clear(); . . . } Last time it was working fine (before new Google Map API announce by Android team in I/O 2013). However, after that I adapted my code to use this new API. Now, I don't know why this method

2022-04-29 00:36:42    分类:问答    android   google-maps   google-maps-markers   android-mapview

How can I remove the shadow on the markers on my map?

I am displaying a custom marker on my Google Map. They are placed fine, but they have this funny shadow. How can I remove the shadow? @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { super.draw(canvas, mapView, shadow); // ---translate the GeoPoint to screen pixels--- Point screenPts = new Point(); mapView.getProjection().toPixels(geoPnt, screenPts); // ---add the marker--- /*Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pushpin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 67, null);*/ return true; } }

2022-04-27 11:03:33    分类:问答    java   android   google-maps   overlay   android-mapview

How to Create Dynamically numbered Pin Pointers on MapView?

I want to display some locations on my MapView. These locations will show pins which will have numbers 1,2,3.. so on(Similar to Google maps result but it is A,B,C..). I think it is not feasible to have pins of all numbers. Is there any way that i can just create a layout with pin background with TextView and I will dynamically put number in TextView and that layout ill use as drawable pin?? Or any other method to achieve this?? Please provide some suggestions. (I am able to show different drawable pins on MapView.I just want to create drawables dynamically)

2022-04-26 15:12:40    分类:问答    android   google-maps   android-mapview