Wednesday, 21 August 2013

Android custom colored buttons, avoid redundant code

Android custom colored buttons, avoid redundant code

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?

No comments:

Post a Comment