This commit is contained in:
2026-03-27 09:37:52 +08:00
parent 3aac4e7330
commit 569780ffb4
2 changed files with 12 additions and 1 deletions

View File

@@ -804,7 +804,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
BitmapDescriptor icon = getMarkerIconWithText(mContext, displayName, isRecommend);
MarkerOptions markerOptions = new MarkerOptions().position(latLng).icon(icon).anchor(0.5f, 0.8f); // 重点:调整锚点,确保图标尖端对准经纬度
MarkerOptions markerOptions = new MarkerOptions()
.title(name).
position(latLng).icon(icon).anchor(0.5f, 0.8f);
Marker m = aMap.addMarker(markerOptions);
@@ -929,6 +931,7 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
textView.setText(text);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
textView.setTextColor(Color.BLACK);
textView.setTypeface(null, Typeface.BOLD);
// 设置文字的参数为 WRAP_CONTENT
LinearLayout.LayoutParams textLp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(textLp);