显示问题

This commit is contained in:
2026-03-31 17:12:00 +08:00
parent c527732532
commit ba27799c41
2 changed files with 26 additions and 9 deletions

View File

@@ -61,28 +61,28 @@
-dontwarn com.ta.**
3D 地图 V5.0.0之前:
#3D 地图 V5.0.0之前:
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.amap.mapcore.*{*;}
-keep class com.amap.api.trace.**{*;}
3D 地图 V5.0.0之后:
#3D 地图 V5.0.0之后:
-keep class com.amap.api.maps.**{*;}
-keep class com.autonavi.**{*;}
-keep class com.amap.api.trace.**{*;}
定位
#定位
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}
搜索
#搜索
-keep class com.amap.api.services.**{*;}
2D地图
#2D地图
-keep class com.amap.api.maps2d.**{*;}
-keep class com.amap.api.mapcore2d.**{*;}
导航
#导航
-keep class com.amap.api.navi.**{*;}
-keep class com.autonavi.**{*;}

View File

@@ -91,6 +91,7 @@ import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.platform.PlatformView;
import okhttp3.Call;
import okhttp3.Callback;
@@ -263,7 +264,20 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
suggestionList.setDividerHeight(1);
suggestionList.setDivider(new ColorDrawable(Color.LTGRAY));
suggestionList.setPadding(dp2px(5), dp2px(5), dp2px(5), dp2px(5));
suggestionAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1);
suggestionAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, new ArrayList<>()) {
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
// 获取默认的 View
View view = super.getView(position, convertView, parent);
TextView text = view.findViewById(android.R.id.text1);
text.setTextColor(Color.parseColor("#333333"));
text.setTextSize(14);
view.setBackgroundColor(Color.TRANSPARENT);
return view;
}
};
suggestionList.setAdapter(suggestionAdapter);
suggestionList.setVisibility(View.GONE);
suggestionList.setOnItemClickListener((parent, view, position, id) -> {
@@ -296,8 +310,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
if (s.length() > 1) {
// 使用当前位置的城市进行搜索
String city = currentLatLng != null ? "" : "";
InputtipsQuery query = new InputtipsQuery(s.toString(), city);
query.setCityLimit(true);
InputtipsQuery query = new InputtipsQuery(s.toString(), "");
query.setCityLimit(false);
Inputtips inputtips = new Inputtips(mContext, query);
inputtips.setInputtipsListener(NativeMapView.this);
inputtips.requestInputtipsAsyn();
@@ -548,6 +562,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
new Handler(Looper.getMainLooper()).post(() -> {
if (suggestionNames.size() > 0) {
suggestionList.setVisibility(View.VISIBLE);
suggestionList.setBackgroundColor(Color.WHITE);
// 限制显示的高度
int height = Math.min(suggestionNames.size() * dp2px(45), dp2px(200));
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(