I'm working on a project in which I can use MapFragment or SupportMapFragment as a custom control. I tried to mix custom control(N-18) and Fraggle(N-26) tutorial but I can't make it work.
My Custom Control Class:
public class CustomMapView : MvxFragment
{
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var ignored = base.OnCreateView(inflater, container, savedInstanceState);
return this.BindingInflate(Resource.Layout.CustomMapViewLayout, null);
}
}
My CustomMapViewLayout.axml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
In the FirstView.axml I reference the CustomMapView:
<cc.CustomMapView
android:layout_width="match_parent"
android:layout_height="match_parent" />
(I use the ViewNamespaceAbbreviations in the Setup.cs)
When I try to deploy I get these errors:
MvxBind:Error View Type Not Found - cc.CustomMapView (I'm sure the namespace is correct) Android.Views.InflateException:Loading...
Is there anybody who managed to solve this kind problem?
As far as I know, fragments have to be used within FragmentActivity parents and have to be loaded either using the
fragment
xml tag or using one of the (support) fragment manager methods for dynamic loading within a parent viewgroup.The Mvx code which is reporting
View Type Not Found - cc.CustomMapView
definitely won't work - it's looking for a class which inherits AndroidView
in that namespace, not looking for aFragment
.There may be ways to write more 'dynamic' fragment xml code - but none of the mvvmcross contributors have unearthed any of these yet. For now, I think you'll have to use the Fragments more 'conventionally' - like the ways shown in the N=26 sample