mlistAllGoing的值是在以下赋值的 mViewModel.getAppListData().observe(this) { its -> if (its!==null){ goingAdapter?.let { mlistAllGoing= its.toList() as ArrayList<ApkInfoEntity> mlistShowGoing =mlistAllGoing.subList(0,2).toList() as ArrayList<ApkInfoEntity> it.updateData(mlistShowGoing as ArrayList<ApkInfoEntity>); it.notifyDataSetChanged() } 为何首次删除后mlistAllGoing被设置为空 goingAdapter?.setOnClickListener(object : AppsListAdapter.ClickListener { override fun onDeleteClick( position: Int) { goingAdapter?.let { if(mlistAllGoing!=null && mlistAllGoing.size!=0){ mlistAllGoing.removeAt(position) mlistTmpShowGoing=mlistAllGoing.toMutableList() as ArrayList<ApkInfoEntity> it.updateData(mlistTmpShowGoing); android.util.Log.i("onDeleteClick===after updatedata===>", "mlistAllGoing=$mlistAllGoing") android.util.Log.i("onDeleteClick===after updatedata===>", "mlistTmpShowGoing=$mlistTmpShowGoing") it.notifyDataSetChanged() } mlistAllGoing定义为 private lateinit var mlistAllGoing: ArrayList<ApkInfoEntity>
[quote=引用 3 楼 键盘舞者113 的回复:]简单,默认状态限制行数,点击加载更多,解除限制就行了
简单,默认状态限制行数,点击加载更多,解除限制就行了
80,349
社区成员
91,287
社区内容
加载中
试试用AI创作助手写篇文章吧