Skip to content
Advertisement

how to change the background color of my listview based on a given data as a parameter in android

I have an android application that basically scan a barcode. I have a lists of items and I would like to change a color of my list once the item has been scanned.

Please find the image below for reference.

enter image description here

I would like to change a background color of item to red only if the item remaining is zero. There is a item remaining filed on the right side.

I am not sure how to achieve this.

Advertisement

Answer

Please provide code of adapter for batter understanding. you can do it by conditioning in your recyclerView

for example:

In onBindViewHolder function:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement