Ver Fonte

1.修改Android Apex Mobile Detail地图类型。

Pen Li há 8 anos atrás
pai
commit
f64ac00b97

+ 8 - 5
Apex Mobile/app/src/main/java/com/usai/apex/ShipMap/ShipMap.java

@@ -34,6 +34,8 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
     private MapFragment mGoogleMapView;
     private GoogleMap mGoogleMap;
+    private com.google.android.gms.maps.MapView mMap;
+
     private MapView mBaiduMap;
     private Context mContext;
     private Boolean mUseGoogleMap;
@@ -53,8 +55,6 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
         init(context);
     }
 
-    View v;
-
 
     @CallSuper
     protected void onDetachedFromWindow() {
@@ -90,7 +90,7 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
             mUseGoogleMap = true;
             System.out.println("已经安装");
         }
-        mUseGoogleMap = false;
+//        mUseGoogleMap = false;
 
 //        GooglePlayServicesUtil.isGooglePlayServicesAvailable(mContext.getApplicationContext());
 
@@ -100,9 +100,12 @@ public class ShipMap extends RelativeLayout implements GoogleMap.OnMarkerClickLi
 
             View relativeLayout = LayoutInflater.from(mContext).inflate(R.layout.ship_google_map,null);
 //            mGoogleMapView = relativeLayout.findViewById(R.id.ship_google_map);
-            mGoogleMapView = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
-            mGoogleMapView.getMapAsync(this);
+//            mGoogleMapView = ((MapFragment)((Activity)mContext).getFragmentManager().findFragmentById(R.id.ship_google_map));
+//            mGoogleMapView.getMapAsync(this);
 
+            mMap = relativeLayout.findViewById(R.id.ship_google_map);
+            mMap.onCreate(null);
+            mMap.getMapAsync(this);
 
             LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
             addView(relativeLayout,layoutParams);

+ 10 - 3
Apex Mobile/app/src/main/res/layout/ship_google_map.xml

@@ -10,11 +10,18 @@
 
     <!--</com.google.android.gms.maps.MapView>-->
 
-    <fragment
-        android:id="@+id/ship_google_map"
-        android:name="com.google.android.gms.maps.MapFragment"
+    <!--<fragment-->
+        <!--android:id="@+id/ship_google_map"-->
+        <!--android:name="com.google.android.gms.maps.MapFragment"-->
+        <!--android:layout_width="match_parent"-->
+        <!--android:layout_height="match_parent"-->
+        <!--/>-->
+
+    <com.google.android.gms.maps.MapView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:id="@+id/ship_google_map"
         />
 
+
 </RelativeLayout>