diff --git a/ln_jq_app/android/app/proguard-rules.pro b/ln_jq_app/android/app/proguard-rules.pro index 4cefaf4..c5b1ef8 100644 --- a/ln_jq_app/android/app/proguard-rules.pro +++ b/ln_jq_app/android/app/proguard-rules.pro @@ -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.**{*;} \ No newline at end of file diff --git a/ln_jq_app/android/app/src/main/java/com/lnkj/ln_jq_app/NativeMapView.java b/ln_jq_app/android/app/src/main/java/com/lnkj/ln_jq_app/NativeMapView.java index 41b9675..86e81e0 100644 --- a/ln_jq_app/android/app/src/main/java/com/lnkj/ln_jq_app/NativeMapView.java +++ b/ln_jq_app/android/app/src/main/java/com/lnkj/ln_jq_app/NativeMapView.java @@ -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(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(