Skip to content Skip to sidebar Skip to footer

Android Button With Text With Different Images For Enabled And Pressed

I am trying to create a stateful Button having Text and an Image on the top via the following code:

From Android Docs:

Enables or disables dithering of the bitmap if the bitmap does not have the same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with an RGB 565 screen).

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

Dithering affects how colors that are higher precision than the device are down-sampled. No dithering is generally faster, but higher precision colors are just truncated down (e.g. 8888 -> 565). Dithering tries to distribute the error inherent in this process, to reduce the visual artifacts.

I hope it helps!

Solution 2:

enable dither attribute in your selector.

android:dither

Boolean. Enables or disables dithering of the bitmap if the bitmap does not have the same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with an RGB 565 screen). For more detail refer this link:http://developer.android.com/guide/topics/resources/drawable-resource.html

Post a Comment for "Android Button With Text With Different Images For Enabled And Pressed"