我正在尝试使用Mapbox Android SDK(7.0.0)和“注释”插件(0.4.0)显示两个圆圈和一条连接它们的直线。用户在两个圆圈中的两个圆圈上单击时,应画出该线。理想情况下,该线应出现在圆圈下方。如果我这样声明线和圆管理器:
lineManager = new LineManager(mapView, mapboxMap, style);
circleManager = new CircleManager(mapView, mapboxMap, style);
从未调用circle.OnClickListener
。如果我这样声明线和圆管理器:
circleManager = new CircleManager(mapView, mapboxMap, style);
lineManager = new LineManager(mapView, mapboxMap, style);
将调用circle.OnClickListener
,但是结果线绘制在圆圈的顶部,如下所示:
而不是这样:
不确定在这里我在做什么错。有没有办法告诉地图在圆圈下方画线?还是我声明LineManager和CircleManager的顺序有问题。
谢谢!
编辑
这是我的build.gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "http://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
并且:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "nocompany.datacollectionapp"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.0.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.5.0-SNAPSHOT'
implementation 'com.android.support:design:28.0.0'
}
导致gradle构建错误Failed to resolve: com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.5.0-SNAPSHOT
答案 0 :(得分:1)
您的想法是正确的,并且关于
从不调用circle.OnClickListener。
这很可能是already resolved.,您可以使用com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.5.0-SNAPSHOT测试解决方案,但请记住包括Sonatype存储库引用。