Android.Views.InflateException:二进制XML文件行#1:错误导致类片段this one my activity
当我构建我的应用并点击按钮显示地图时,它会在SetContentview中显示异常 请帮我解决这个错误
我的活动类===> 公共类MapViewActivity:Activity,IOnMapReadyCallback { private List customerViewModelList;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.map_view);
//FragmentManager.FindFragmentById<MapFragment>(Resource.Id.map).GetMapAsync(this);
MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
customerViewModelList = (List<CustomerSummaryViewModel>)StaticObjects.GetObjectFromDictionary("CustomerSummaryViewModel");
ImageView closePopup = FindViewById<ImageView>(Resource.Id.iv_close);
closePopup.Click += delegate
{
Finish();
};
mapFragment.GetMapAsync(this);
}
public void OnMapReady(GoogleMap googleMap)
{
MarkerOptions markerOptions = new MarkerOptions();
if (SFAContext.Instance!=null)
{
if (SFAContext.Instance.currentLocation!= null)
markerOptions.SetPosition(new LatLng(SFAContext.Instance.currentLocation.Latitude, SFAContext.Instance.currentLocation.Longitude));
else
{
markerOptions.SetPosition(new LatLng(17.4562377, 78.3679737));
}
}
markerOptions.SetTitle("My Position");
markerOptions.SetIcon((BitmapDescriptorFactory.FromResource(Resource.Drawable.current_position)));
googleMap.AddMarker(markerOptions);
try
{
if (customerViewModelList.Count > 0 && customerViewModelList != null)
{
MarkerOptions customerPosition = null;
for (int i = 0; i < customerViewModelList.Count; i++)
{
customerPosition = new MarkerOptions();
customerPosition.SetPosition(new LatLng(CommonFunctions.getDoubleValue(customerViewModelList[i].StoreLatitude),
CommonFunctions.getDoubleValue(customerViewModelList[i].StoreLongitude)));
customerPosition.SetTitle(customerViewModelList[i].StoreUID + " " + customerViewModelList[i].StoreName);
if (!string.IsNullOrEmpty(customerViewModelList[i].StoreLatitude) && !string.IsNullOrEmpty(customerViewModelList[i].StoreLongitude))
{
googleMap.AddMarker(customerPosition);
}
}
}
googleMap.UiSettings.ZoomControlsEnabled = true;
googleMap.UiSettings.CompassEnabled = true;
googleMap.MoveCamera(CameraUpdateFactory.ZoomIn());
if (SFAContext.Instance == null)
{
googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(SFAContext.Instance.currentLocation.Latitude, SFAContext.Instance.currentLocation.Longitude), 18.0f));
}
else
googleMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(17.4562377, 78.3679737), 17.0f));
}
catch (Exception ex)
{
}
}
}