android Check mark on button click

user1155857 picture user1155857 · Mar 12, 2012 · Viewed 11.4k times · Source

On click of a button , a check mark icon should be displayed on the leftmost corner of the button, when reclicked on the same button , the check mark icon should disppear. Could some on help me out in this case?

Answer

SMBiggs picture SMBiggs · Apr 10, 2012

While this is already answered, here's an alternative solution: add a unicode checkmark symbol. There are two of them: \u2713 and \u2714. Just add them to your strings:

<string name="button_label_on">\u2713 on</string>
<string name="button_label_off">off</string>

Of course, you can put this directly into your layout code, too:

<Button
   ...
   android:text="\u2713 on"
   />