小编Heb*_*lis的帖子

如何在recyclerview中实现,拖放和滑动删除?

嗨,我是 Kotlin 的新手,我在其中进行了近 1 个月的编程,我有一个回收器,我正在尝试重新排序回收器中的卡片视图,并通过滑动删除不需要的卡片,我该如何实现这个?可以用图书馆来完成吗?我找不到一个

这就是我所拥有的:

适配器

    open class EmployeesAdapter(var context: Context, var employee:ArrayList<EmployeesTest>):BaseAdapter() {

    private class ViewHolder(row: View?) {

        var txt_user: TextView
        var user_job: TextView
        var img_user: ImageView
        var checBox: CheckBox

        init {
            this.txt_user = row?.findViewById(R.id.txt_user) as TextView
            this.img_user = row.findViewById(R.id.img_user) as ImageView
            this.user_job = row.findViewById(R.id.user_job) as TextView
            this.checBox = row.findViewById(R.id.checkBox) as CheckBox


        }
    }

    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {

        var view: View
        var viewHolder: ViewHolder
        if (convertView == null) {
            var layout = …
Run Code Online (Sandbox Code Playgroud)

android kotlin

4
推荐指数
1
解决办法
9603
查看次数

标签 统计

android ×1

kotlin ×1