Here's a code snippet. When a 32x32 image is displayed, its top is
cropped - but if more text is added to the same line, it appears as
expected.

public class TestActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
                TextView textView  = (TextView) findViewById(R.id.textview);
                SpannableString ss = new SpannableString("abc");
                Drawable d = getResources().getDrawable(R.drawable.icon32);

                d.setBounds(0, 0, d.getIntrinsicWidth(), 
d.getIntrinsicHeight());
                ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
                ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

                textView.setText(ss);
    }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to