It looks like you actually want the image to be inline with the text.
In this case, you wouldn't use an
ImageView. You would create a
Spannable that contains an
ImageSpan and assign it to the
String str = "Thank you very much [icon]"; int start = str.indexOf("[icon]"); int end = start + "[icon]".length(); SpannableString ss = new SpannableString(str); Drawable d = getResources().getDrawable(R.drawable.headphones); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); ImageSpan span = new ImageSpan(d); ss.setSpan(span, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(ss);