Android Question

Custom item list view with Image View after the last character of textview

I want custom item list view same image
enter image description here

what can i do to create item list view with small image view just like in the picture
Thank you very much

Answer Source

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 TextView.

        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);