I created an Android app with a 4x6 grid of buttons. This buttons should all have different background colors.
I could achieve this by creating 24 custom shapes like drawable\red_botton.xml
, drawable\green_botton.xml
, ... and set them as android:background
property.
But this would produce tons of redundant xml code. Is there a better way?