mirror of
				https://github.com/AdrianKuta/Unbound-Drag-Drop.git
				synced 2025-10-31 00:13:39 +01:00 
			
		
		
		
	Update README.md
This commit is contained in:
		
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							| @@ -71,6 +71,16 @@ val dragDropHelper = DragDropHelper(MyDragDropCallback()) | |||||||
| dragDropHelper.attachToRecyclerView(recyclerView) | dragDropHelper.attachToRecyclerView(recyclerView) | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | # | ||||||
|  | ### Step 3: Enable long click | ||||||
|  |  | ||||||
|  | Dragging is enabled only for views with long click enabled. To allow dragging and dropping of RecyclerView items, you need to set isLongClickable to true for each RecyclerView item. | ||||||
|  |  | ||||||
|  | ```kotlin | ||||||
|  | viewHolder.itemView.isLongClickable = true | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  |  | ||||||
| --- | --- | ||||||
|  |  | ||||||
| See example in `app` module. | See example in `app` module. | ||||||
|   | |||||||
| @@ -37,6 +37,7 @@ class SimpleGridPageAdapter : | |||||||
|  |  | ||||||
|     override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) { |     override fun onBindViewHolder(viewHolder: ViewHolder, position: Int) { | ||||||
|         val data = asyncListDiffer.currentList[position] |         val data = asyncListDiffer.currentList[position] | ||||||
|  |         viewHolder.itemView.isLongClickable = true | ||||||
|         viewHolder.bind(data) |         viewHolder.bind(data) | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -46,7 +47,6 @@ class SimpleGridPageAdapter : | |||||||
|  |  | ||||||
|         fun bind(task: Task) { |         fun bind(task: Task) { | ||||||
|             binding.textView.text = task.title |             binding.textView.text = task.title | ||||||
|             binding.root.isLongClickable = true |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user