【问题标题】:Plotting PolyLine on Google Map not working Android在谷歌地图上绘制折线无法正常工作 Android
【发布时间】:2015-01-18 12:22:59
【问题描述】:

我正在尝试在我的 Android 地图上绘制一条折线。我已阅读其他堆栈溢出答案,但他们没有纠正我的问题。我确实已将 google play 服务作为依赖项添加到我的应用程序中。

    apply plugin: 'com.android.application'


android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.mattboyle.windowrunner"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
//apply plugin: 'android-unit-test'

//afterEvaluate {
//    tasks.findByName("assembleDebug").dependsOn("testDebugClasses")
//}

dependencies {
//    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.beardedhen:androidbootstrap:+'
    compile 'com.google.android.gms:play-services:6.5.87'
    compile 'com.telly:groundy:1.5'
    compile 'com.telly:groundy-compiler:1.5'



}

这是我非常简单的代码:

System.out.println("About to add to polyoptions");
        PolylineOptions routeOption = new PolylineOptions().addAll(RunningMap.routeToPlot);
    System.out.println("Added them all and routeoptions is of size "+routeOption.getPoints().size());
    Polyline polyline = map.addPolyline(routeOption);
    System.out.println("Should have plotted now..");

它击中了所有系统输出。

PolylineOptions.size() 返回 102 并且似乎没有任何其他错误。

地图已正确初始化,我可以在我的安卓屏幕上看到它。

map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
            .getMap();

这似乎应该可以工作,但我不明白为什么不能。我真的很感激任何建议。

【问题讨论】:

    标签: android google-maps maps google-play-services


    【解决方案1】:

    PolyLine Options的谷歌官方文档中,没有类似size()的方法。这可能是您遇到错误的可能原因。请参阅文档了解支持的方法。

    希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-16
      • 2015-10-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多