Skip to content Skip to sidebar Skip to footer

Trying To Set An Image In Textview From In Strings.xml In Android

I am trying to set an image stored in assets folder in strings.xml and set that string to a TextView. Is this possible? Strings.xml has the following string: + getResources().getDrawable(R.drawable.yourimage) + "'/>", imageGetter, null);

now set it to TextView

textView.setText(spanned);

Edit

<string name="nofriends">No Friends.. ####</string> //#### to replace with imageString s=res.getString(R.string.nofriends);
s=s.replace("####",spanned);
textView.setText(s);

Solution 2:

TextView's are not designed to be used like this. What you should be doing instead is setting the drawable attribute on a TextView.

See a great answer to a similar problem here.

Post a Comment for "Trying To Set An Image In Textview From In Strings.xml In Android"