Search code examples
androidxamarinandroid-viewpagermvvmcross

BindableViewPager in Xamarin Android


I am working on Xamarin Android Application.I want to use BindableViewPager of Cheesebaron.But I am getting this exception when I use BindableViewPager: android.view.InflateException: Binary XML file line #1: Error inflating class BindableViewPager My Code is :

<?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="match_parent"
      android:layout_height="wrap_content">
<BindableViewPager
      android:id="@+id/viewpager"
      android:layout_width="match_parent"
      android:layout_height="150dp"
      local:MvxItemTemplate="@layout/viewpager_item"
      local:MvxBind="ItemsSource Carousel_Images"/>
</LinearLayout>

And this is my ItemTemplate:

 <?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="match_parent"
              android:layout_height="match_parent">
<Mvx.MvxImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="fitXY"
    android:src="@drawable/loading"
    local:MvxBind="ImageUrl ImageURL" />
</LinearLayout>

Solution

  • I have solved this issue myself : I have added two classes BindableViewPager.cs and MvxBindablePagerAdapter from Here and it works perfectly.Thank you Cheesbaron for such a nice article