标签: android-maps

使用Geocoder(Android)绘制路径是否有限制?

我能够在两个位置之间绘制一条路径,但如果距离太长 - 超过300公里 - 则路径未完全绘制.

我正在使用下面的代码来绘制路径:

class MapOverlay extends com.google.android.maps.Overlay {
    Road mRoad;
    ArrayList<GeoPoint> mPoints;

    public MapOverlay(Road road, MapView mv) {
            mRoad = road;
            if (road.mRoute.length > 0) {
                    mPoints = new ArrayList<GeoPoint>();
                    for (int i = 0; i < road.mRoute.length; i++) {
                            mPoints.add(new GeoPoint((int) (road.mRoute[i][1] * 1000000),
                                            (int) (road.mRoute[i][0] * 1000000)));
                    }
                    int moveToLat = (mPoints.get(0).getLatitudeE6() + (mPoints.get(
                                    mPoints.size() - 1).getLatitudeE6() - mPoints.get(0)
                                    .getLatitudeE6()) / 2);
                    int moveToLong = (mPoints.get(0).getLongitudeE6() + (mPoints.get(
                                    mPoints.size() - 1).getLongitudeE6() - mPoints.get(0)
                                    .getLongitudeE6()) / …
Run Code Online (Sandbox Code Playgroud)

android google-maps overlay shape android-maps

6
推荐指数
1
解决办法
941
查看次数

我可以在MapView的叠加层中使用AnimationDrawable吗?

我用XML创建了一个AnimationDrawable,它工作正常.但是在将drawable移动到MapView作为叠加标记(替换一个工作正常的静态drawable)时,动画固执地拒绝播放.我已将调用start()移动到一个按钮进行测试,即使在MapView显示几秒后按下,动画也无法启动.我在logcat中什么也看不到.我知道start()需要在所有窗口设置完成后调用,但这似乎是一个单独的问题.

AnimationDrawables与MapView兼容吗?

有什么特别的东西需要我在MapView中做一个工作吗?

你有没有成功地在MapView中完成一项工作?

使用Matt的解决方案(下面)我通过将ImageView放在MapView的图层中而不是使用叠加来添加AnimationDrawable.

public void showAnimatedMarker(GeoPoint point) {
    LinearLayout v = (LinearLayout) View.inflate(context, R.layout.markerlayout, null);
    ImageView marker = (ImageView) v.findViewById(R.id.marker);
    AnimationDrawable markerImage = (AnimationDrawable)marker.getDrawable();
    this.addView(v, 0, new MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, point, MapView.LayoutParams.BOTTOM_CENTER));
    markerImage.start();
}
Run Code Online (Sandbox Code Playgroud)

然后是markerlayout.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
    <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/marker"
            android:src="@drawable/my_animation_drawable"
    />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-maps android-mapview

6
推荐指数
1
解决办法
3182
查看次数

旋转的OpenStreetMap视图 - 在Android中旋转后如何在手指移动方向上滑动地图?

我正在使用OSM作为地图应用程序,我在这里按行程方向旋转地图,如Android Rotating MapView所述.这很好用.

但是,我还没有设法调整dispatchTouchEvent代码来计算用户触摸的地图旋转效果(现在当地图旋转90度时,用户的水平扫描将垂直移动地图等).示例代码仅提供预告片:

   public boolean dispatchTouchEvent(MotionEvent ev) {
        // TODO: rotate events too
        return super.dispatchTouchEvent(ev);
    }
Run Code Online (Sandbox Code Playgroud)

任何指导将不胜感激.

当我在它时 - 是否仍然可以单独定位缩放控件,以便它们在地图旋转时不旋转?我读到不推荐使用getZoomControls().(为什么?)

android android-maps

6
推荐指数
1
解决办法
2167
查看次数

如何使用给定纬度和经度的标记/叠加项目启动地图意图?

我有经纬度,我想打开那个中心的谷歌地图.所以我使用以下代码:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
    Uri.parse("geo:"+lat +","+lng));
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

但是,这不会在中心放置标记.我想在我开始时放置某种标记(并且可选择某种名称).知道如何实现这一目标吗?

android android-intent android-maps

6
推荐指数
1
解决办法
9112
查看次数

嵌入式Google地图无法在WebView中获取当前位置

我按照本教程:http://android-er.blogspot.com/2013/03/embed-google-map-in-webview.html

我试图在WebView中使用Google Map,但它无法获取我当前的位置.我在WebView上启用了JavaScript.我还需要启用什么?

有谁知道为什么会这样?它不应该促使我使用我当前的位置?

请注意,我对使用MapView作为替代方案不感兴趣.我想知道我需要在WebView上设置什么,或者可能在设备的位置服务上?

google-maps android-maps android-4.0-ice-cream-sandwich google-places-api google-places

6
推荐指数
1
解决办法
7044
查看次数

Android动态更改圆圈大小只有圆圈的一半正确更新

所以我给用户控件使用搜索栏来改变MapView中圆形覆盖对象的半径.

但是,当您拖动搜索条以更改圆的半径时,只有其底部部分会平滑更新:

错误

上半部分是什么,圆的半径,底部是在圆的半径是目前.底部部分平滑更新(以及搜索栏上的进度),但顶部保持静止半秒左右.

以前见过这样的事吗?这是我正在使用的RadiusOverlay对象的onDraw方法:

public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    super.draw(canvas, mapView, shadow); 

    Point point = new Point();

    Projection projection = mapView.getProjection();
    projection.toPixels(mGeoPoint, point);
    float projectedRadius = projection.metersToEquatorPixels((float)(mRadius * 1609.3d));

    Paint paint = new Paint();
    paint.setStyle(Paint.Style.FILL);
    paint.setARGB(50, 41, 166, 247);
    paint.setAntiAlias(true);

    canvas.drawCircle((float)point.x, (float)point.y, projectedRadius, paint);
}
Run Code Online (Sandbox Code Playgroud)

谢谢你看看.

android android-maps android-canvas

5
推荐指数
1
解决办法
1248
查看次数

在SupportMapFragment中引用MapView

我有一个扩展SupportMapFragment的片段.

public class PlaceMapsFragment extends SupportMapFragment {
    private GoogleMap mMap;
    private LatLng mPosFija;

    public PlaceMapsFragment() {
        super();
    }

    public static PlaceMapsFragment newInstance(LatLng posicion) {
        PlaceMapsFragment frag = new PlaceMapsFragment();
        frag.mPosFija = posicion;
        return frag;
    }

    @Override
    public GoogleMap getMap() {
        // TODO Auto-generated method stub
        return super.getMap();
    }

    @Override
    public void onCreate(Bundle arg0) {
        // TODO Auto-generated method stub
        super.onCreate(arg0);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        //initMap();
        return view; …
Run Code Online (Sandbox Code Playgroud)

android android-maps android-fragments supportmapfragment

5
推荐指数
2
解决办法
4880
查看次数

Google Maps Android API v2 - MarkerOptions可拖动且可见的方法

我正在玩本月早些时候发布的新版谷歌地图Android API(v2),我很高兴看到一种MarkerOptions.draggable(boolean draggable)方法,我认为在传递draggable值时会创建一个可拖动的标记true.然而,在尝试它(即向地图添加标记)时,它似乎没有做任何事情.

MarkerOptions.visible(boolean visible)我也认为该方法在传递visible值时会隐藏标记false.

任何人都能够使用这些方法吗?

android android-maps android-mapview google-play-services google-maps-android-api-2

5
推荐指数
1
解决办法
5856
查看次数

如何在Google地图中将位置标记放入离线状态?

我想在连接可用时保存的地图上将标记放在谷歌地图上.我使用的离线地图来自此方法.

android google-maps android-maps

5
推荐指数
0
解决办法
878
查看次数

如何使用map apiv2或map api v3在android中进行markererclusterer

并告诉我正确的模拟器规范...它可以是模拟器的错误......

我试过通过以下链接

https://www.google.co.in/?gws_rd=cr&ei=iCf5Upm7KsWXrAedkoCoDg#q=marker+cluster+example+in+android
http://karnshah8890.blogspot.in/2013/04/clustering-on-google-map-v2.html
https://developers.google.com/maps/documentation/android/utility/marker-clustering
https://developers.google.com/maps/documentation/android/utility/marker-clustering
http://stackoverflow.com/questions/7447350/android-maps-point-clustering
http://stackoverflow.com/questions/14204554/google-maps-marker-clusters-in-android
https://github.com/twotoasters/clusterkraf/
https://github.com/nodesagency-mobile/Android-Google-Map-V2-Sample
https://github.com/googlemaps/android-maps-utils/tree/master/demo/src/com/google/maps/android/utils/demo/model
https://github.com/Bersh/MarkersCluster/blob/master/res/menu/activity_main.xml
https://github.com/damianflannery/Polaris/blob/clustering/sample/src/com/cyrilmottier/android/polarissample/util/Config.java
http://umut.tekguc.info/en/content/google-android-map-v2-step-step
http://stackoverflow.com/questions/15495171/cluster-markers-in-google-maps-android-v2/15510054#15510054
Run Code Online (Sandbox Code Playgroud)

我正在尝试构建需要标记聚类的应用程序,所以我已经尝试了很多次阅读Google API创建演示但每次显示错误都建议我也是Web应用程序使用map API v3聚类标记哪个API我必须使用API​​ v2或apiv3的地图来构建应用程序,请帮助我,我是Android新手或给我一些链接,我可以找到我的解决方案

.............................mainactivity class..........................................

    package com.example.cluster;

    import java.util.ArrayList;

    import java.util.LinkedHashMap;
    import java.util.concurrent.ExecutionException;

    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Point;
    import android.os.Bundle;
    import android.support.v4.app.FragmentActivity;
    import android.view.Menu;

    import com.example.demo.MarkerClusterizer;
    import com.google.android.gms.maps.CameraUpdateFactory;
    import com.google.android.gms.maps.GoogleMap;
    import com.google.android.gms.maps.MapFragment;
    import com.google.android.gms.maps.model.BitmapDescriptorFactory;
    import com.google.android.gms.maps.model.CameraPosition;
    import com.google.android.gms.maps.model.LatLng;
    import com.google.android.gms.maps.model.MarkerOptions;

    public class MainActivity extends FragmentActivity {
         private ArrayList<MarkerOptions> markers = new ArrayList<MarkerOptions>();
            private Bitmap markerImage;
            private float oldZoom = 0;
            private GoogleMap …
Run Code Online (Sandbox Code Playgroud)

android google-maps-api-3 android-maps android-mapview android-maps-v2

5
推荐指数
1
解决办法
1105
查看次数