It is possible to use only one image file using the ColorFilter method. However, ColorFilter expects to work with ImageViews, not buttons, so you need to convert your buttons to ImageViews. This is not a problem if you use images as buttons in any case, but it is more annoying if you have text ... In any case, assuming you find a way to solve the problem with the text, the code is used here:
ImageView button = (ImageView) findViewById(R.id.button); button.setColorFilter(0xFFFF0000, PorterDuff.Mode.MULTIPLY);
This is a red overlay on the button (the color code is the hex code for a fully opaque red color - the first two digits are transparency, then RR GG BB.).
You can make your ImageViews look like regular buttons by copying the btn_default_normal.9.png file from your sdkfolder / platform / (version and data of Android / res / drawable to your own project. Then in your ImageView use android:background="@drawable/btn_normal_default" and android:src="..." to set the image inside the button.
Steve haley
source share