Friday, April 26, 2013

[android help] Set semi-transparent drawable on top of TextView at runtime


In an application to manage the costs of a living community, an user can 'terminate' a month, which is then stored in a database.


In a specific Activity of this app, there are shown the last four months including their attribute 'terminated'. I want to show this to the user by putting a semi-transparent hook on top of the TextView containing this month. Consider this image as example:


enter image description here


It seems that this doesn't work properly in Android.



textView.setCompoundDrawablesWithIntrinsicBounds(...)


does put the image on top, and it's semi-transparent too, but the initial text of the TextView disappears. Additionally, since now I haven't discovered yet how to scale the image into that TextView.


This is the actual output:


enter image description here


Can anybody help me with that? Should I define the scaling parameters directly in the XML layout file?



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...