しかし、特定の基準に基づいて、listViewのいくつかの項目のドラッグ&ドロップを無効にする必要があります。ヘルプは高く評価されます。
DraggableListView.cs
のOnLongPress
イベントで行うことができます。 OnLongPress
イベントでは、長押しの項目の位置と長さは既に取得されているので、長押しした項目を取得するだけです。「特定の条件」に従ってif文を追加してください。
public void OnLongPress (MotionEvent e)
{
mTotalOffset = 0;
int position = PointToPosition (mDownX, mDownY);
if (position < 0 || !LongClickable)
return;
//added codes
var item=Adapter.GetItem(position);
//if the user long pressed a Vegetables, then it can't be drag and drop
if (item != null && item.ToString() == "Vegetables")
{
return;
}
int itemNum = position - FirstVisiblePosition;
...
}