Alternately color list elements in Mendix Native

0
I have alist view which is receiving data from rest api. I want to set the background color alternately for the list elements i.e every alternate row(containing list elements)  in the list should have a different background color for the container. Can I use the nth child logic with even and odd rows here in the CSS? Any ideas on how to achieve this in Mendix native? I want to achieve design like the below screenshot. Here is listView containing names list received from rest api ListView as an attribute {name} in a container to retrieve all the names. How I specify which name should be green and which should be in white?
asked
2 answers
2

See https://docs.mendix.com/howto/mobile/native-styling.

The file styles → native → core → widgets → listview.js contains the options of your listview, but no obvious parameter to get this striping pattern done.

Give the background options a try as you can find in ../variables.js by setting secondary to #F88 for instance:

let background = {
    primary: "#FFF",
    secondary: setContrastScale(0.03, "#FFF"),
};

 

answered
0

Hi Ankita, 
Did you already find a solution? I'm trying to have a different style for the first and last listitem in my native app but can't find how.

Kolien

answered