today i experienced a little „problem“ with a ListView that i want to share with you.
I had a ListView defined in an XML layout file:
For some reason i now needed to create it programmatically. So i did the following to create an equivalent ListView:
ListView listView = new ListView(context);
But somehow the divider didn’t show up anymore. So what was the reason for that? It was just the order! Somehow setting the divider color after setting it’s height doesn’t work and the height is reset to 0. So changing the order to first setting the color and then setting the height fixed the problem!