Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin-可在recyclerview中使用Swipeable cardview?_C#_Android_Android Fragments_Xamarin - Fatal编程技术网

C# Xamarin-可在recyclerview中使用Swipeable cardview?

C# Xamarin-可在recyclerview中使用Swipeable cardview?,c#,android,android-fragments,xamarin,C#,Android,Android Fragments,Xamarin,我正在浏览fortysevendeg.swipelistview.swipelistview。示例应用程序运行良好 在这里,您可以找到该库的代码和示例 下面是一个xml文件: <com.fortysevendeg.swipelistview.SwipeListView xmlns:swipe="http://schemas.android.com/apk/res-auto" android:id="@+id/example_lv_list" android

我正在浏览fortysevendeg.swipelistview.swipelistview。示例应用程序运行良好

在这里,您可以找到该库的代码和示例

下面是一个xml文件:

<com.fortysevendeg.swipelistview.SwipeListView xmlns:swipe="http://schemas.android.com/apk/res-auto"
        android:id="@+id/example_lv_list"
        android:listSelector="#00000000"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        swipe:swipeFrontView="@+id/front"
        swipe:swipeBackView="@+id/back"
        swipe:swipeDrawableChecked="@drawable/choice_selected"
        swipe:swipeDrawableUnchecked="@drawable/choice_unselected"
        swipe:swipeCloseAllItemsWhenMoveList="true"
        swipe:swipeMode="both"
        swipe:swipeActionRight="reveal"
        swipe:swipeActionLeft="dismiss"
        swipe:swipeOpenOnLongPress="false" />

这是我的密码

[Activity(Label = "Swipe ListView", MainLauncher = true)]
    public class MainActivity : FragmentActivity
    {
        SwipeListView _swipeListView;
        DogsAdapter _adapter;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            ActionBar.SetIcon(new ColorDrawable(Android.Graphics.Color.Transparent));

            _swipeListView = FindViewById<SwipeListView>(Resource.Id.example_lv_list);

            _adapter = new DogsAdapter(this, Dogs.GetDogData());

            _swipeListView.FrontViewClicked += HandleFrontViewClicked;
            _swipeListView.BackViewClicked += HandleBackViewClicked;
            _swipeListView.Dismissed += HandleDismissed;

            _swipeListView.Adapter = _adapter;
        }

        void HandleFrontViewClicked (object sender, SwipeListViewClickedEventArgs e)
        {
            Toast.MakeText(this,"click",ToastLength.Short);
            RunOnUiThread(() => _swipeListView.OpenAnimate(e.Position));
            //my Stuff to do currently a toast
RunOnUiThread(()=>Toast.MakeText(Application.Context,"click",ToastLength.Short));
        }

        void HandleBackViewClicked (object sender, SwipeListViewClickedEventArgs e)
        {
            RunOnUiThread(() => _swipeListView.CloseAnimate(e.Position));
        }

        void HandleDismissed (object sender, SwipeListViewDismissedEventArgs e)
        {
            foreach (var i in e.ReverseSortedPositions)
            {
                _adapter.RemoveView(i);
            }
        }
    }
[活动(Label=“滑动列表视图”,MainLauncher=true)]
公共类MainActivity:碎片活动
{
SwipeListView_SwipeListView;
狗用适配器;
创建时受保护的覆盖无效(捆绑包)
{
base.OnCreate(bundle);
//从“主”布局资源设置视图
SetContentView(Resource.Layout.Main);
SetIcon(新的彩色绘图(Android.Graphics.Color.Transparent));
_swipeListView=FindViewById(Resource.Id.example\u lv\u列表);
_adapter=newdogsadapter(这是Dogs.GetDogData());
_swipeListView.FrontViewClicked+=HandleFrontViewClicked;
_swipeListView.BackViewClicked+=手柄靠背视图已单击;
_swipeListView.Disposed+=已处理Ismissed;
_swipeListView.Adapter=\u Adapter;
}
无效HandleFrontViewClicked(对象发送器、SwipeListViewClickedEventArgs e)
{
Toast.MakeText(这个“点击”,ToastLength.Short);
RunOnUiThread(()=>_swipeListView.OpenAnimate(e.Position));
//我现在要做的事情是干杯
RunOnUiThread(()=>Toast.MakeText(Application.Context,“click”,ToastLength.Short));
}
已单击无效手柄靠背视图(对象发送器、SwipeListViewClickedEventArgs e)
{
RunOnUiThread(()=>_swipeListView.CloseAnimate(e.Position));
}
void HandleDismissed(对象发送器,SwipeListViewDismissedEventArgs e)
{
foreach(e.ReverseSortedPositions中的var i)
{
_适配器。移除视图(i);
}
}
}
当我向代码中添加未执行的额外内容时

目前,我在HandleFrontViewClicked中添加了两种可能的祝酒词,但没有一种会触发

我想问两个问题:

  • 我该怎么做我需要的事情呢?比如说,敬酒

  • 如何在代码中检测向左向右滑动


  • 谢谢你的帮助

    你找到问题了吗?