0

I am having a vertical LinearLayout with many TextViews in there. Now I want to have a check-icon in front of all of them, which can be checked or unchecked.

[x] test1
[ ] test2
[x] test2
[ ] test4

Is there a way to do that without any additional views? In html you would set the background image for the TextViews, but when I do that in android, the background graphic gets distorted.

1
  • 1
    You should use a CheckedTextView instead of a regular TextView. Sep 30, 2014 at 22:31

1 Answer 1

2

Use either android:drawableLeft="@drawable/yourcheckimage" on your TextView item in your XML layout

or

Use one of the setCompoundDrawablesXXX methods of TextView to accomplish this programmatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.