C# Xamarin-可在recyclerview中使用Swipeable cardview?
我正在浏览fortysevendeg.swipelistview.swipelistview。示例应用程序运行良好 在这里,您可以找到该库的代码和示例 下面是一个xml文件: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
<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中添加了两种可能的祝酒词,但没有一种会触发
我想问两个问题:
谢谢你的帮助你找到问题了吗?