I have used RecyclerView for showing thumbnails in my Image Editing app.Each item of its comprises of a ImageView(thumbnail) and a textView.In my application I want to
If you don't want to use notifyDataSetChanged
Implemented by kotlin
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
adapterOrders = OrdersSendAdapter(this, listOrders)
recyclerOrders = view.findViewById(R.id.recycler_orders)
recyclerOrders.layoutManager = LinearLayoutManager(activity)
recyclerOrders.setHasFixedSize(true)
recyclerOrders.addItemDecoration(DividerItemDecoration(activity, DividerItemDecoration.VERTICAL))
recyclerOrders.adapter = adapterOrders
}
/* This method will be call when item of adapter has an event */
fun getListDetail(position: Int, idOrders: String) {
for (index in 0 until recyclerOrders.childCount) {
recyclerOrders[index].setBackgroundColor(Color.parseColor("#ffffff"))
}
recyclerOrders[position].setBackgroundColor(ContextCompat.getColor(context!!, R.color.color_select))
}