I want to know how to create a cancel panel for Xamarin Android something like this.

I used this code created by Dan Ardelean for Xamarin Android, which bases the code example Roman Nurik for android , but this does not work for me. I get this message:
Unable to activate instance of type SwipeDismissListView.MainActivity from native handle 0x200019 (key_handle 0xf9f4bcb). --->
System.MissingMethodException: No constructor found for SwipeDismissListView.MainActivity::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership) ---> Java.Interop.JavaLocationException: Exception of type 'Java.Interop.JavaLocationException' was thrown. --- End of inner exception stack trace --- at Java.Interop.TypeManager.CreateProxy (System.Type type, System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00054] in <d855bac285f44dda8a0d8510b679b1e2>:0 at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x00111] in <d855bac285f44dda8a0d8510b679b1e2>:0 --- End of inner exception stack trace --- at Java.Interop.TypeManager.CreateInstance (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type targetType) [0x0017d] in <d855bac285f44dda8a0d8510b679b1e2>:0 at Java.Lang.Object.GetObject (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer, System.Type type) [0x000b9] in <d855bac285f44dda8a0d8510b679b1e2>:0 at Java.Lang.Object._GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00017] in <d855bac285f44dda8a0d8510b679b1e2>:0 at Java.Lang.Object.GetObject[T] (System.IntPtr handle, Android.Runtime.JniHandleOwnership transfer) [0x00000] in <d855bac285f44dda8a0d8510b679b1e2>:0 at Android.Views.View.get_Context () [0x0001f] in <d855bac285f44dda8a0d8510b679b1e2>:0 at XpressCode.SwipeDismissListViewTouchListener..ctor (Android.Widget.ListView listView, XpressCode.IDismissCallbacks callbacks) [0x00021] in D:\...\Xamarin-SwipeToDismiss-master\SwipeDismissListView\SwipeDismissListViewTouchListener.cs:58 at SwipeDismissListView.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00086]
I searched the Internet for sample code, but I did not find anything like it.
I tried to add a constructor comment block,
public MainActivity() { }
but I get the error:
{System.InvalidCastException: Specified cast is not valid. at Android.Widget.AbsListView.SetOnScrollListener (Android.Widget.AbsListView+IOnScrollListener l) [0x0000c] in <d855bac285f44dda8a0d8510b679b1e2>:0 at SwipeDismissListView.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x000a0] in D:\...\Xamarin-SwipeToDismiss-master\SwipeDismissListView\MainActivity.cs:45 }
Then I deleted the created constructor and added a try ... cacth block. The application is broken into this line:
list.SetOnScrollListener(touchListener.MakeScrollListener());
THIS COMMUNICATION CODE:
MainActivity.cs
using System; using Android.App; using Android.Content; using Android.Runtime; using Android.Views; using Android.Widget; using Android.OS; using System.Collections.Generic; using XpressCode; namespace SwipeDismissListView { [Activity (Label = "SwipeDismissListView", MainLauncher = true, Icon = "@drawable/icon")] public class MainActivity : Activity,IDismissCallbacks,IUndoListener { UndoBarController mUndoBarController; ArrayAdapter<String> mAdapter; ListView list; protected override void OnCreate (Bundle bundle) { try { base.OnCreate(bundle);
SwipeDismissListViewTouchListener.cs
using System; using Android.Views; using Android.Widget; using System.Collections.Generic; using Android.Graphics; using Android.Animation; using Java.Util; using Android.OS; namespace XpressCode { public interface IDismissCallbacks { bool canDismiss (int position); void onDismiss (ListView listView, int[] reverseSortedPositions); } public class SwipeDismissListViewTouchListener:Java.Lang.Object,Android.Views.View.IOnTouchListener {
UndoBarController.cs
using System; using Android.Views; using Android.Views; using Android.OS; using Android.Widget; using Android.Text; using Android.Runtime; using Android.Animation; using Java.Lang; using Newtonsoft.Json; using System.Collections.Generic; using SwipeDismissListView; namespace XpressCode { public interface IUndoListener { void OnUndo (object obj); } public class UndoBarController { View mBarView; TextView mMessageView; ViewPropertyAnimator mBarAnimator; Handler mHideHandler = new Handler (); internal IUndoListener mUndoListener;
Main.axml
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" style="?android:listSeparatorTextViewStyle" android:text="@string/heading_dismissable_list_view" /> <ListView android:id="@+id/lstItems" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> <LinearLayout android:id="@+id/undobar" style="@style/UndoBar"> <TextView android:id="@+id/undobar_message" style="@style/UndoBarMessage" /> <Button android:id="@+id/undobar_button" style="@style/UndoBarButton" /> </LinearLayout> </FrameLayout>
What am I doing wrong? Thank you for your help!