RecyclerView拖动问题

我在onResume创建initDatafa方法请求数据,数据放到RecyclerView控件该空间有一个拖动方法 class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {}
首次进来是正确的 当我跳转到第二个页面往RecyclerView添加数据再返回时SimpleItemTouchHelperCallback 这个方法构造函中获取数据个数是对的 但是onMove里这个方法里面数据个数就不对
onSelectedChanged方法中状态ItemTouchHelper.ACTION_STATE_IDLE:也是不对的图片说明

1个回答

在这个其他框架用就好了何必纠结

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
RecyclerView 滑动删除与拖动的实现
RecyclerView 滑动删除与拖动的实现
RecyclerView的拖动和滑动
在安卓中,有许多关于如何使用RecyclerView实现“drag & drop”与swipe-to-dismiss”的教程,库和例子。即使现在已经有了新的,更优的实现方式,大多数仍然是使用老旧的View.OnDragListener以及Roman Nurik在SwipeToDismiss中所使用的方法。很少有人使用新的api,反而要么经常依赖于GestureDetectors和onInter
RecyclerView的侧滑删除和长按拖动
1.二话不说,先来一个简单的RecyclerView1.1MainActivity中onCreat()代码 rv_main = (RecyclerView) findViewById(R.id.rv_main);rv_main.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false)); //r
RecyclerView拖动和侧滑简析
前言 前面已经探索了ListView的拖动和侧滑功能实现,RecyclerView作为ListView的替代者,在拖动和侧滑功能实现上它有系统提供的实现方式,ItemTouchHelper就是实现这些功能的系统工具类,使用这个工具大大减轻了开发者的工作负担,现在就来用它实现拖动和侧滑功能。 实现效果 实现过程 ItemTouchHelper的功能相当强大,它能够支持线性表格和瀑布流...
RecyclerView横向拖动
RecyclerView 横向 拖动
recyclerview的item拖动排序
recyclerview的item拖动排序,item里面控件触摸进行拖动排序
Recyclerview可拖动侧滑
recyclerview条目可拖动、侧滑删除
Android-可拖动排序的RecyclerView
可拖动排序的RecyclerView
上下拖动,左右滑动的RecyclerView
文章中贴的代码不全,大家可下载查看全部代码
RecyclerView 实现侧滑删除和拖动排序
在使用ListView的时候实现拖动排序,主要靠继承别人第三方的,在网上有很多例子, 这里不介绍,主要是介绍一下recycleview的拖动排序和滑动删除 一、主要知识点:             1、 ItemTouchHelper.Callback的使用              2、接口传值 ItemTouchHelper.Callback       getMovementFl
RecyclerView拖动条目顺序+侧滑删除
拖动RecyclerView条目实现条目排序,以及侧滑条目删除条目。
跨多个RecyclerView拖动排序
先介绍一下本文出现的背景,项目中有这样一个需求,拖动一个列表的某一项排序或者拖动到另外一个列表中。 其效果如下图: 拖动排序在RecyclerView有现成的解决方案,配合ItemTouchHelper即可轻松实现。但是要将一个列表中的Item拖动到另一个列表中去,就不那么容易了。 先来看看这种跨界面实现由那些难点,我们先分析,再一个一个的解决。 拖动视图的保存,ItemTouchH...
RecyclerView 拖动才刷新内容
RecyclerView 拖动才刷新内容遇到问题是在ViewPager中的某个RecyclerView明明在UI线程调用了它的adapter.notifydatasetchanged()方法,但是UI就是没有刷新,且用手指拖动界面之后其才会刷新。 这个问题常见于内存消耗比较大,貌似Fragment被怎么回收了?这个时候监听Viewpager的onPageSelected事件,切换完tab之后调用
使用RecyclerView实现可拖动图文混排发帖
(效果图为最终项目中的)本文源码已经托管在GitHub上,欢迎Fork多多star。地址最近重构一个项目,增加了一个新需求,要类似汽车之家的图文混排发帖,图片文字可自由移动位置(如效果图)功能:图文混排,自由排列文字与图片的位置,图片之间自动加入输入框,两个输入框若相邻且有一个为空,则删除一个保留另外一个,若都有内容则不删除,删除文字时,若输入框内容为空,则删除整个输入框实现:RecyclerVie
RecyclerView之ItemTouchHelper仿今日头条频道管理拖动
Github地址:这里写链接内容 ItemTouchHelper的使用ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new ItemTouchHelper.Callback() { @Override public int getMovementFlags(RecyclerView rec
RecyclerView下拉刷新,滑动删除以及拖动变换位置
RecyclerView下拉刷新,滑动删除以及拖动变换位置好久都没有写博客了!前段时间做项目比较忙,在项目中用了RecyclerView替换了listview,感觉还是挺不错的!以下就把学习的过程和写的东西分享给大家: 关于RecyclerView的介绍什么的我就不过多说了,网上有很多这个例子了,具体的方法我是参考了 http://www.cnblogs.com/Fndroi
可拖动、可滑动的组件===》RecyclerView
最近因为项目需要所以碰到了一个需要重新排序的ListView布局,然后就去网上找了一个严振杰(noHttp的作者)写的一个demo,运行成功之后就去看代码,看了半天感觉代码的可读性很差,本来很简单的事被他封装了好几层实现,所以我就开始研究了代码了。 实际上这个可交换item位置也可以滑动删除的控件是用RecyclerView实现的。下面就给大家从代码开始分析一下实现原理。 这个Recycler
RecyclerView长按拖动效果,用ItemTouchHelper实现
RecyclerView长按拖动效果,用ItemTouchHelper实现 话不多说,直接上代码 //NewItemTouchHelper继承自ItemTouchHelper.Callback NewItemTouchHelper helper = new NewItemTouchHelper(context, adapter, info);ItemTouchHelper itemTouchHe
RecyclerView实现拖动排序和滑动删除功能
RecyclerView 的拖动排序需要借助一下 ItemTouchHelper 这个类,ItemTouchHelper 类是 Google 提供的一个支持 RecyclerView 滑动和拖动的一个使用类,下面使用该类实现 RecyclerView 的滑动删除和拖动排序功能。首先大概介绍一下 ItemTouchHelper 的一个内部抽...
RecyclerView 拖动/滑动多选的实现(2)
方案三: AndroidDragSelect前文说到,方案三就是分析了方案一的缺点之后,给出了自己的基于 OnItemTouchListener 的实现方案,耦合度低,可以很容易集成进现有的项目当中。从自定义 RecyclerView 的方案中可以看到,它是在事件分发的时候进行处理。
RecyclerView借助ItemTouchHelper实现拖动和滑动删除功能
RecyclerView是官方推荐取代ListView的空间,如何实现RecyclerView列表元素的拖动呢? 官方提供了ItemTouchHelper类使用步骤如下: 定义ItemTouchHelper.Callback实现类,以下是几个重要的方法 package com.zms.copyapp.helper; import android.suppor
recyclerView的VR效果+折叠+拖动换位
recyclerView的VR效果+折叠+拖动换位https://blog.csdn.net/qq_34468274/article/details/81386296
RecyclerView 拖动/滑动多选的实现(1)
为什么要做滑动多选?可以看到众多 ROM 的系统应用都实现了滑动多选的功能,例如三星的文件管理器,OPPO 的短信等等,不知道来源是不是 Google 相册。因为交互上与 Google 相册的策略都是一致的。
RecyclerView实现拖动排序和滑动删除功能
RecyclerView 的拖动排序需要借助一下 ItemTouchHelper 这个类,ItemTouchHelper 类是 Google 提供的一个支持 RecyclerView 滑动和拖动的一个使用类,下面使用该类实现 RecyclerView 的滑动删除和拖动排序功能。首先大概介绍一下 ItemTouchHelper 的一个内部抽象类 Callback 类。 ItemTouchHelper
上下左右拖动并且加载不同布局的RecyclerView
不仅可以上下拖动,左右滑动,还可以加载不同的item布局的RecyclerView
RecyclerView的侧滑删除和长按拖动2--动画的添加
承接上一篇为侧滑删除添加动画效果1.在自定义的callback中重写onChildDraw方法@Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int
请教一个RecyclerView嵌套RecyclerView的问题
我获取到图片一中的JSON数据,list节点中的为RecyclerView子item RecyclerView的数据,外层RecyclerView的数据我成功获取并解析展示成功,但是每条item中RecyclerView的数据该怎么通过集合去添加呢?因为两个RecyclerView的数据都是从一个接口返回过来的JSON数据,所以我是共用的一个数据beanrn[img=https://img-bbs.csdn.net/upload/201802/27/1519716586_312879.png][/img][img=https://img-bbs.csdn.net/upload/201802/27/1519716592_600391.png][/img]rnrn
RecyclerView嵌套横向RecyclerView卡顿问题
自定义RecyclerView重写下面两个方法,屏蔽RecyclerView的滑动监听: @Override public boolean onInterceptTouchEvent(MotionEvent e) { //返回false,则把事件交给子控件的onInterceptTouchEvent()处理 return false; } @Override publi...
拖动问题
bool isMouseDown = false;rn Point mouseOffset;rnrnprivate void label1_MouseUp(object sender, MouseEventArgs e)rn rn if (e.Button == MouseButtons.Left)rn rn isMouseDown = false;rn rn rnrn private void label1_MouseMove(object sender, MouseEventArgs e)rn rn if (isMouseDown)rn rn Point mousePos = Control.MousePosition;rn mousePos.Offset(mouseOffset.X, mouseOffset.Y);rn this.Location = mousePos;rn rn rnrn private void label1_MouseDown(object sender, MouseEventArgs e)rn rn if (e.Button == MouseButtons.Left)rn rn mouseOffset = new Point(-e.X, -e.Y);rn isMouseDown = true;rn rn rnrnrn我想实现一个Label的拖动,但是一拖动鼠标就跑到Form的0,0坐标上了,怎么回事啊。rnrn还有 除了这样 还能怎么实现控件的拖动呢?
拖动的问题
我将两个文本框和一个按钮紧挨着,按钮在两个文本框中间,当我左右移动按钮时,文本框的宽度也变化,即一个变小一个变大,但总宽度不变,不只应用什么事件,我用了窗体的dragdrop和按钮的mousemove都不能很好的实现。请大侠们指点一二:)
recyclerview
recyclerview嵌套recyclerview
RecyclerView
RecyclerView的学习案例
拖动的问题?????????
TREEVIEW中拖动节点时只能显示大图标吗?能不能实现像资源管理器一样的小图表+文件名(节点的TEXT)的拖动效果?谢谢!
拖动问题?
Declare Function RegisterClass Lib "user32" Alias "RegisterClassA" (Class As WNDCLASS) As LongrnDeclare Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As String, ByVal hInstance As Long) As LongrnDeclare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As LongrnDeclare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongrnDeclare Sub PostQuitMessage Lib "user32" (ByVal nExitCode As Long)rnDeclare Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long) As LongrnDeclare Function TranslateMessage Lib "user32" (lpMsg As Msg) As LongrnDeclare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As Msg) As LongrnDeclare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As LongrnDeclare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As LongrnDeclare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongrnDeclare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As LongrnDeclare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongrnDeclare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As LongrnType WNDCLASSrn style As Longrn lpfnwndproc As Longrn cbClsextra As Longrn cbWndExtra2 As Longrn hInstance As Longrn hIcon As Longrn hCursor As Longrn hbrBackground As Longrn lpszMenuName As Stringrn lpszClassName As StringrnEnd TypernType POINTAPIrn x As Longrn y As LongrnEnd TypernType Msgrn hWnd As Longrn message As Longrn wParam As Longrn lParam As Longrn time As Longrn pt As POINTAPIrnEnd TypernPublic Const WS_OVERLAPPED = &H0&rnPublic Const WS_POPUP = &H80000000rnPublic Const WS_CHILD = &H40000000rnPublic Const WS_MINIMIZE = &H20000000rnPublic Const WS_VISIBLE = &H10000000rnPublic Const WS_DISABLED = &H8000000rnPublic Const WS_CLIPSIBLINGS = &H4000000rnPublic Const WS_CLIPCHILDREN = &H2000000rnPublic Const WS_MAXIMIZE = &H1000000rnPublic Const WS_CAPTION = &HC00000rnPublic Const WS_BORDER = &H800000rnPublic Const WS_DLGFRAME = &H400000rnPublic Const WS_VSCROLL = &H200000rnPublic Const WS_HSCROLL = &H100000rnPublic Const WS_SYSMENU = &H80000rnPublic Const WS_THICKFRAME = &H40000rnPublic Const WS_GROUP = &H20000rnPublic Const WS_TABSTOP = &H10000rnPublic Const WS_MINIMIZEBOX = &H20000rnPublic Const WS_MAXIMIZEBOX = &H10000rnPublic Const WS_TILED = WS_OVERLAPPEDrnPublic Const WS_ICONIC = WS_MINIMIZErnPublic Const WS_SIZEBOX = WS_THICKFRAMErnPublic Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)rnPublic Const WS_TILEDWINDOW = WS_OVERLAPPEDWINDOWrnPublic Const WS_POPUPWINDOW = (WS_POPUP Or WS_BORDER Or WS_SYSMENU)rnPublic Const WS_CHILDWINDOW = (WS_CHILD)rnPublic Const WS_EX_DLGMODALFRAME = &H1&rnPublic Const WS_EX_NOPARENTNOTIFY = &H4&rnPublic Const WS_EX_TOPMOST = &H8&rnPublic Const WS_EX_ACCEPTFILES = &H10&rnPublic Const WS_EX_TRANSPARENT = &H20&rnPublic Const COLOR_WINDOW = 5rnPublic Const WM_NULL = &H0rnPublic Const WM_CREATE = &H1rnPublic Const WM_DESTROY = &H2rnPublic Const WM_MOVE = &H3rnPublic Const WM_SIZE = &H5rnPublic Const SW_SHOWNORMAL = 1rnPublic Const GWL_WNDPROC = -4rnPrivate Const WM_LBUTTONDOWN = &H201rnPrivate Const WM_MOUSEMOVE = &H200rnPrivate Const WM_LBUTTONUP = &H202rnrnDim hwnd2 As Long, hwnd3 As Long, old_proc As Long, new_proc As LongrnDim IsDrag As BooleanrnPublic Sub Main()rn Dim lngTemp As Longrn If MyRegisterClass Thenrn If MyCreateWindow Thenrn new_proc = GetMyWndProc(AddressOf ButtonProc)rn old_proc = SetWindowLong(hwnd2, GWL_WNDPROC, new_proc)rn MyMessageLooprn End Ifrn MyUnregisterClassrn End IfrnEnd SubrnPrivate Function MyRegisterClass() As Booleanrn Dim wndcls As WNDCLASSrn wndcls.lpfnwndproc = GetMyWndProc(AddressOf MyWndProc)rn wndcls.cbClsextra = 0rn wndcls.cbWndExtra2 = 0rn wndcls.hInstance = App.hInstancern wndcls.hbrBackground = COLOR_WINDOWrn wndcls.lpszMenuName = 0rn wndcls.lpszClassName = "myWindowClass"rn MyRegisterClass = (RegisterClass(wndcls) <> 0)rnEnd FunctionrnPrivate Sub MyUnregisterClass()rn UnregisterClass "myWindowClass", App.hInstancernEnd SubrnPrivate Function MyCreateWindow() As Booleanrn Dim hWnd As Longrn Dim style As Longrn hWnd = CreateWindowEx(0, "myWindowClass", "My Window", WS_OVERLAPPEDWINDOW Xor WS_GROUP, 0, 0, 400, 300, 0, 0, App.hInstance, ByVal 0&)rn hwnd2 = CreateWindowEx(0, "Button", "My button", WS_CHILD, 50, 55, 100, 25, hWnd, 0, App.hInstance, ByVal 0&)rn hwnd3 = CreateWindowEx(0, "edit", "My textbox", WS_CHILD, 50, 25, 100, 25, hWnd, 0, App.hInstance, ByVal 0&)rn If hWnd <> 0 Then ShowWindow hWnd, SW_SHOWNORMALrn ShowWindow hwnd2, SW_SHOWNORMALrn ShowWindow hwnd3, SW_SHOWNORMALrn MyCreateWindow = (hWnd <> 0)rnEnd FunctionrnPrivate Function MyWndProc(ByVal hWnd As Long, ByVal message As Long, ByVal wParam As Long, ByVal lParam As Long) As Longrn Select Case messagern Case WM_DESTROYrn PostQuitMessage (0)rn Case WM_LBUTTONDOWNrn IsDrag = Truern Case WM_MOUSEMOVErn If IsDrag = True Thenrn Debug.Print "Drag" & Nowrn End Ifrn Case WM_LBUTTONUPrn If IsDrag = True Thenrn IsDrag = Falsern End Ifrn End Selectrn MyWndProc = DefWindowProc(hWnd, message, wParam, lParam)rnEnd FunctionrnFunction GetMyWndProc(ByVal lWndProc As Long) As Longrn GetMyWndProc = lWndProcrnEnd FunctionrnPrivate Sub MyMessageLoop()rn Dim aMsg As Msgrn Do While GetMessage(aMsg, 0, 0, 0)rn DispatchMessage aMsgrn LooprnEnd SubrnPrivate Function ButtonProc(ByVal hWnd As Long, ByVal message As Long, ByVal wParam As Long, ByVal lParam As Long) As Longrn Dim x As Integerrn If (message = 533) Thenrn x = MsgBox("You clicked on the button", vbOKOnly)rn End Ifrn ButtonProc = CallWindowProc(old_proc, hWnd, message, wParam, lParam)rnEnd Functionrn==========================rn把这段代码放到模块中去,运行,在窗口空白处按下左键然后拖到按钮上去,发现在按钮上拖动时并不显示数据?有没有办法让其在按钮上拖动时仍然显示数据(看立即窗口)?
RecyclerView嵌套RecyclerView
参考这篇文章然后自己改成需要的,http://www.cnblogs.com/zhujiabin/p/7045812.html,谢谢这个作者。不过我也不知道这个性能咋样,大家可以先去看看博客内容 http://blog.csdn.net/qq_30543115/article/details/77161736 ,看是不是自己需要的,然后在下载吧。
Recyclerview
Recyclerview item点击及增删
recyclerView
recyclerView demo
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法