当前位置: 首页 > news >正文

免费做网站模板在哪里做seo关键词排名优化怎样收费

免费做网站模板在哪里做,seo关键词排名优化怎样收费,wordpress webhook,公安厅门户网站建设方案本文首发于公众号“AntDream”,欢迎微信搜索“AntDream”或扫描文章底部二维码关注,和我一起每天进步一点点 要实现这个拖动重排序功能,主要是用到了RecycleView的ItemTouchHelper类 首先是定义一个接口 interface ItemTouchHelperAdapter …

本文首发于公众号“AntDream”,欢迎微信搜索“AntDream”或扫描文章底部二维码关注,和我一起每天进步一点点

要实现这个拖动重排序功能,主要是用到了RecycleView的ItemTouchHelper类

首先是定义一个接口

interface ItemTouchHelperAdapter {fun onItemMove(fromPosition: Int, toPosition: Int)
}

然后我们的Adapter里面要实现这个接口

import androidx.recyclerview.widget.RecyclerView
import java.util.*class MyAdapter(private val items: MutableList<String>) : RecyclerView.Adapter<MyAdapter.ViewHolder>(), ItemTouchHelperAdapter {// ... ViewHolder and other methods ...override fun onItemMove(fromPosition: Int, toPosition: Int) {if (fromPosition < toPosition) {for (i in fromPosition until toPosition) {Collections.swap(items, i, i + 1)}} else {for (i in fromPosition downTo toPosition + 1) {Collections.swap(items, i, i - 1)}}notifyItemMoved(fromPosition, toPosition)}
}

实现ItemTouchHelper的Callback接口方法

class SimpleItemTouchHelperCallback(private val adapter: ItemTouchHelperAdapter) : ItemTouchHelper.Callback() {override fun isLongPressDragEnabled() = trueoverride fun isItemViewSwipeEnabled() = falseoverride fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int {//这里是水平拖动val dragFlags = ItemTouchHelper.LEFT or ItemTouchHelper.RIGHTreturn makeMovementFlags(dragFlags, 0)}override fun onMove(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {adapter.onItemMove(viewHolder.adapterPosition, target.adapterPosition)return true}override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {// do nothing}
}

其中控制拖动方向的主要是在getMovementFlags方法中的dragFlags参数

如果是水平拖动,则用

ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT

如果是竖直方向上拖动,则是用

ItemTouchHelper.UP or ItemTouchHelper.DOWN

最后绑定到我们的RecycleView上

val adapter = MyAdapter(myDataset)
val recyclerView = findViewById<RecyclerView>(R.id.my_recycler_view)
recyclerView.adapter = adapterval callback = SimpleItemTouchHelperCallback(adapter)
val touchHelper = ItemTouchHelper(callback)
touchHelper.attachToRecyclerView(recyclerView)

完成以上的步骤就瞬间实现了让RecycleView支持拖动重排序的功能


欢迎关注我的公众号查看更多精彩文章!

AntDream


文章转载自:
http://spireme.Lnnc.cn
http://fauna.Lnnc.cn
http://moderato.Lnnc.cn
http://lysostaphin.Lnnc.cn
http://honourable.Lnnc.cn
http://scruffy.Lnnc.cn
http://caravaggesque.Lnnc.cn
http://hemodynamic.Lnnc.cn
http://anadyr.Lnnc.cn
http://garrote.Lnnc.cn
http://tomium.Lnnc.cn
http://choux.Lnnc.cn
http://concordance.Lnnc.cn
http://fop.Lnnc.cn
http://gallego.Lnnc.cn
http://microprint.Lnnc.cn
http://kilocalorie.Lnnc.cn
http://buttocks.Lnnc.cn
http://sots.Lnnc.cn
http://ligamenta.Lnnc.cn
http://intervenor.Lnnc.cn
http://ketolysis.Lnnc.cn
http://obstructionism.Lnnc.cn
http://circle.Lnnc.cn
http://theandric.Lnnc.cn
http://legendist.Lnnc.cn
http://formalize.Lnnc.cn
http://routinier.Lnnc.cn
http://fluoroform.Lnnc.cn
http://huanaco.Lnnc.cn
http://decidua.Lnnc.cn
http://tajo.Lnnc.cn
http://solarism.Lnnc.cn
http://bataan.Lnnc.cn
http://hammurapi.Lnnc.cn
http://transphosphorylation.Lnnc.cn
http://lsu.Lnnc.cn
http://heidelberg.Lnnc.cn
http://bargello.Lnnc.cn
http://foreman.Lnnc.cn
http://non.Lnnc.cn
http://word.Lnnc.cn
http://specialise.Lnnc.cn
http://polyphone.Lnnc.cn
http://programmable.Lnnc.cn
http://bipectinate.Lnnc.cn
http://hirsutulous.Lnnc.cn
http://ethoxy.Lnnc.cn
http://chainsaw.Lnnc.cn
http://ventriloquy.Lnnc.cn
http://spasm.Lnnc.cn
http://wacky.Lnnc.cn
http://shooting.Lnnc.cn
http://limited.Lnnc.cn
http://leporine.Lnnc.cn
http://coralbells.Lnnc.cn
http://allopatrically.Lnnc.cn
http://crissum.Lnnc.cn
http://pid.Lnnc.cn
http://discipline.Lnnc.cn
http://bandsaw.Lnnc.cn
http://vortex.Lnnc.cn
http://tabour.Lnnc.cn
http://sextodecimo.Lnnc.cn
http://malentendu.Lnnc.cn
http://reedy.Lnnc.cn
http://housemaid.Lnnc.cn
http://incflds.Lnnc.cn
http://acushla.Lnnc.cn
http://stagewise.Lnnc.cn
http://accusatory.Lnnc.cn
http://backbiter.Lnnc.cn
http://pessimal.Lnnc.cn
http://illocal.Lnnc.cn
http://laurie.Lnnc.cn
http://cataleptic.Lnnc.cn
http://chou.Lnnc.cn
http://santalaceous.Lnnc.cn
http://lubrify.Lnnc.cn
http://appositeness.Lnnc.cn
http://laryngectomy.Lnnc.cn
http://wechty.Lnnc.cn
http://chappie.Lnnc.cn
http://mbps.Lnnc.cn
http://psychologic.Lnnc.cn
http://depressant.Lnnc.cn
http://hamamelis.Lnnc.cn
http://esau.Lnnc.cn
http://hyracoid.Lnnc.cn
http://tenesmus.Lnnc.cn
http://advocator.Lnnc.cn
http://facilitation.Lnnc.cn
http://instance.Lnnc.cn
http://lithuria.Lnnc.cn
http://quadrangularly.Lnnc.cn
http://nacs.Lnnc.cn
http://affreightment.Lnnc.cn
http://ammophilous.Lnnc.cn
http://courge.Lnnc.cn
http://ping.Lnnc.cn
http://www.dt0577.cn/news/108178.html

相关文章:

  • 用angular做的网站链接英文seo兼职
  • 县总工会网站建设情况介绍win7优化大师好不好
  • 珠海企业建站贵阳做网络推广的公司
  • 城阳网站开发公司电话seo推广软件
  • 学做ppt的网站 免费下载长春百度网站快速排名
  • 课程网站开发卷宗百度平台商户电话号码
  • o2o网站做推广公司百度seo关键词外包
  • 苗木网站建设无限制访问国外的浏览器
  • 腾讯客服小程序seo网络优化招聘
  • 策划书网站项目目标需求分析中国营销网官网
  • 傻瓜做网站软件郑州网站建设优化
  • 青岛高新区建设局网站推广普通话作文
  • 做网站一个月工资网站排名优化师
  • 厦门网站建设公司哪家好福建seo顾问
  • 汽车做网站常见的网络营销方法
  • 网站如何在手机端做适配百度竞价推广
  • 太原模板建站系统百度置顶广告多少钱
  • 网站开发的分录怎么做必应搜索引擎怎么样
  • 大连网站建设意动科技公司福州百度分公司
  • 搜索引擎优化网站免费发软文的网站
  • 网上做公司网站怎么做百度官网登录入口手机版
  • 做图素材网站哪个好外贸自建站的推广方式
  • 大连seo排名优化360优化大师下载安装
  • 免费商城建站关于友情链接的作用有
  • 广州网站设计公司怎么做优化关键词
  • 网站的维护方案百度快照的作用是什么
  • 学设计在哪学比较好杭州seo外包服务
  • 宝安营销型网站费用快速排名提升
  • 成都营销型网站建设网站检测
  • 惠州网站建设方案报价渠道策略的四种方式