Question

I've got a custom BindableExpandableListView that uses different ItemTemplates depending on the type of the item. When I do now have an item that should use a Layout that includes a MvxBindableLinearLayout it throws an

Android.Views.InflateException: Loading...

Exception with pointing at the GetBindableView Method of the MvxAdapter.

the error:

[0:] 
MvxBind:Error: 35,20 View type not found - Mvx.MvxBindableLinearLayout
[0:] MvxBind:Error: 35,20 View type not found - Mvx.MvxBindableLinearLayout
03-28 11:25:37.508 I/mono-stdout( 4758): MvxBind:Error: 35,20 View type not found - Mvx.MvxBindableLinearLayout
An unhandled exception occured.
03-28 11:25:43.248 I/dalvikvm( 4758): threadid=3: reacting to signal 3
03-28 11:25:43.278 I/dalvikvm( 4758): Wrote stack traces to '/data/anr/traces.txt'
03-28 11:25:47.398 I/MonoDroid( 4758): UNHANDLED EXCEPTION: Android.Views.InflateException: Exception of type 'Android.Views.InflateException' was thrown.
03-28 11:25:47.398 I/MonoDroid( 4758): at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00064] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/a1e3982a/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:194
03-28 11:25:47.398 I/MonoDroid( 4758): at Android.Views.LayoutInflater.Inflate (int,Android.Views.ViewGroup,bool) [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/a1e3982a/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.LayoutInflater.cs:468
In mgmain JNI_OnLoad
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.CommonInflate (int,Android.Views.ViewGroup,Cirrious.MvvmCross.Binding.Droid.Binders.IMvxLayoutInfactorFactory,bool) <IL 0x00046, 0x00287>
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.BindingInflate (int,Android.Views.ViewGroup,bool) <IL 0x00015, 0x00107>
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.BindingContext.MvxAndroidBindingContext.BindingInflate (int,Android.Views.ViewGroup) <IL 0x00004, 0x00063>
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.Views.MvxListItemView..ctor (Android.Content.Context,Cirrious.MvvmCross.Binding.Droid.Views.IMvxLayoutInflater,object,int) <IL 0x0001a, 0x000cf>
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.CreateBindableView (object,int) <IL 0x00013, 0x000bb>
Unhandled Exception:

Android.Views.InflateException: Loading...
03-28 11:25:47.398 I/MonoDroid( 4758): at Cirrious.MvvmCross.Binding.Droid.Views.MvxAdapter.GetBindableView (Android.Views.View,object,int) <IL 0x00027, 0x0027b>
The program 'Mono' has exited with code 0 (0x0).

My Layouts:
Expandable List containing Sections:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:minWidth="25px"
    android:minHeight="25px"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <BindableExpandableListView
        android:descendantFocusability="blocksDescendants"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/EventList"
        android:groupIndicator="@null"
        android:dividerHeight="1px"
        android:divider="#cccccc"
        android:fadingEdgeLength="0px"
        local:MvxBind="ItemsSource Sections; ItemClick ItemSelectedCommand; ItemLongClick ItemLongClickCommand"
        local:GroupItemTemplate="@layout/eventlistitem_header" />
</LinearLayout>

Item Template for problematic Items:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <TextView
        android:layout_width="fill_parent"
        android:id="@+id/txt_myEventTitle"
        android:textSize="8pt"
        android:textColor="#000000"
        android:gravity="center_vertical"
        android:layout_height="wrap_content"
        android:paddingLeft="12dip"
        android:paddingTop="12dip"
        android:paddingBottom="12dip"
        android:background="#ffffff"
        local:MvxBind="Text Title" />
    <Mvx.MvxBindableLinearLayout
        android:layout_width="fill_parent"
        android:orientation="vertical"
        android:id="@+id/list_EventDetail_Ranking"
        android:layout_height="wrap_content"
        local:MvxBind="ItemsSource Ranking"
        local:MvxItemTemplate="@layout/eventlistsubitem_rank" />
</LinearLayout>

The Item template for the BindableLinearLayout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/linearLayout1">
    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="22dip">
        <TextView
            android:text="1."
            android:layout_width="0dp"
            android:layout_weight="0.1"
            android:textSize="6.5pt"
            android:textColor="#666666"
            android:gravity="center_vertical"
            android:layout_height="match_parent"
            android:paddingLeft="12dip"
            android:background="#ffffff"
            local:MvxBind="Text Rank" />
        <TextView
            android:text="Krasser Typ"
            android:layout_width="0dp"
            android:layout_weight="0.65"
            android:textSize="6.5pt"
            android:textColor="#666666"
            android:gravity="center_vertical"
            android:layout_height="match_parent"
            android:background="#ffffff"
            local:MvxBind="Text Player" />
        <TextView
            android:text="0"
            android:layout_width="0dp"
            android:layout_weight="0.25"
            android:layout_height="fill_parent"
            android:textSize="6.5pt"
            android:textColor="#000000"
            android:background="#ebebeb"
            android:gravity="center_vertical"
            android:paddingLeft="12dip"
            android:textStyle="bold"
            local:MvxBind="Text Mark" />
    </LinearLayout>
</LinearLayout>

And the method that calls the GetBindableView method of the MvxAdapter within the BindableExpandableListViewAdapter:

    public View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView,
        ViewGroup parent)
    {
        var sublist = ((_itemsSource[groupPosition]) as SectionModel).Events.ToList();

        var item = sublist[childPosition];

        // Item Template depends on Datatype
        if (item is EventListModel1)
            ItemTemplateId = Resource.Layout.eventlistitem_event1;
        else if (item is EventListModel2)
            ItemTemplateId = Resource.Layout.eventlistitem_event2;
        else if (item is EventListModel3)
            ItemTemplateId = Resource.Layout.eventlistitem_event3;
        else if (item is RankEventModel)
            ItemTemplateId = Resource.Layout.eventlistitem_rank;
        else
            ItemTemplateId = Resource.Layout.eventlistitem_null;

        return base.GetBindableView(convertView, item, ItemTemplateId);
    }

So basically what I need is a Expandable List that contains the following:
Level 1 (Dynamic contains Sections)
-- Level 2 (Dynamic contains Events with different Layouts for different Events)
--- Level 3 (Only needed for a specific EventType contains a Ranking Table with dynamic amount of entries)

Was it helpful?

Solution

The error is "View type not found - Mvx.MvxBindableLinearLayout"

This looks like you are using very old code? MvxBindableLinearLayout was a vNext class. In v3, we simplified the naming - so names like MvxLinearLayout were used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top