Android 앱을 최신 GoogleMaps V2와 함께 Marshmallow 23으로 업그레이드하고 있습니다. 내가 한 이유 중 하나는 최신지도가 .zIndex 매개 변수를 허용하기 때문에지도에 그릴 물건의 Z- 색인을 설정할 수 있기 때문입니다.GoogleMap .z 인덱스 매개 변수와 관련된 문제
하지만 내 문제는 컴파일러가 일부 addMarker 문에서 사용할 수 있지만 다른 문안에서는 사용할 수 없다는 것입니다. 그러나이 다음 코드는 .zIndex 받아들이
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
useLibrary 'org.apache.http.legacy' //httpClient not supported in 23.
defaultConfig {
applicationId "com.deanblakely.myappname"
minSdkVersion 16
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':library')
//compile project(':googleplayservices_lib')
compile files('libs/gson-2.2.4.jar')
compile 'com.android.support:appcompat-v7:23+'
compile 'com.android.support:design:23+'
//compile 'com.google.android.gms:play-services:9.4.0' too big. we just need maps and gcm
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
}
: 이것은 내 build.gradle 파일이
private void addLegMarker(GoogleMap map, double lat, double lon,
String title, String snippet, float bearing)
{
//this method adds the permanent pin to the map and "moves" the arrow representing the target
//following two floats put the pin point exactly on the blue line
float u = (float) 0.2;
float v = (float) 1.0;
//following float center the arrow
float center = (float) 0.5;
//float myRotation = (float) 90.0;
//add the permanent pin to the location...
map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
.title(title)
.snippet(snippet)
.anchor(u, v))
.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.cpin)
.zIndex(1.0f)
);
if (!(lastArrowMarker == null))
{
lastArrowMarker.remove();
}
String ArrowSnippet = "Last known position of target phone";
lastArrowMarker = map.addMarker(new MarkerOptions()
.position(new LatLng(lat, lon))
.anchor(center, center)
.snippet(ArrowSnippet)
.rotation(bearing)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.smallredarrow)
.zIndex(1.0f)
));
}
입니다 : 다음 코드에서
컴파일러 플래그 .zIndex 방법을 해결할 수없는 말 그냥 괜찮습니다 :플래그가 지정되는 곳에서지도 개체가 인수로 전달되고 잘 작동하는 경우 코드는지도라는 GoogleMap을 직접 참조하지만 이것이 중요한지는 알 수 없습니다.
컴파일러가이 매개 변수를 한 곳에서 받아들이고 다른 곳에서 플래그를 지정하는 이유는 무엇입니까?
나는'MarkerOptions' 문서에서'setIcon' 메소드를 보지 못했습니다. 아이콘을'아이콘'으로 변경하면 어떻게됩니까? – nasch