I need to make text view with image at right. I need make text wrap around the image at left.
Text may be different length. Image place at top-right always.
Image example:
Х - measns image place.
I need to make text view with image at right. I need make text wrap around the image at left.
Text may be different length. Image place at top-right always.
Image example:
Х - measns image place.
The basic and simple way to achieve this...!
final String testContent = "<html><body><img src=\"ic_launcher.png\" style=\"float:right;\"/>This is like testing if this thing works ghdjdhfjkhgdjkhgkfdjgkljdfkljgklfdjkgljkfd kljlk lj kld jgkljdklgjfdkljgkfldjg kljfdkl dklfgjklfdj gklfdjklg This is like testing if this thing works ghdjdhfjkhgdjkhgkfdjgkljdfkljgklfdjkgljkfd kljlk lj kld jgkljdklgjfdkljgkfldjg kljfdkl dklfgjklfdj gklfdjklg jdfklgjkdfljg kldfjgkljdfklgjdklf. It XXX"
+ " in a more elaborate This is like testing if this thing works ghdjdhfjkhgdjkhgkfdjgkljdfkljgklfdjkgljkfd kljlk lj kld jgkljdklgjfdkljgkfldjg kljfdkl dklfgjklfdj gklfdjklg jdfklgjkdfljg kldfjgkljdfklgjdklf. It XXX"
+ " in a more elaborate This is like testing if this thing works ghdjdhfjkhgdjkhgkfdjgkljdfkljgklfdjkgljkfd kljlk lj kld jgkljdklgjfdkljgkfldjg kljfdkl dklfgjklfdj gklfdjklg jdfklgjkdfljg kldfjgkljdfklgjdklf. It XXX"
+ " in a more elaborate jdfklgjkdfljg kldfjgkljdfklgjdklf. It XXX";
textView.setText(Html.fromHtml(testContent, imgGetter, null));
}
private ImageGetter imgGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable drawable = null;
if (imageNumber == 1) {
drawable = getResources().getDrawable(R.drawable.ic_launcher);
++imageNumber;
} else
drawable = getResources().getDrawable(R.drawable.ic_launcher);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
return drawable;
}
};