Imagespan Size Measurement With Textview And Staticlayout
I have a simple layout contains just one TextView. I wanna load an image into TextView using ImageSpan. Below method creates Spannable: private Spannable getImageSpannable(int draw
Solution 1:
I hope this method works
The following line of code
publicvoidsetContent() {
SpannableStringBuilder content = new SpannableStringBuilder();
content.append(getImageSpannable(R.drawable.my_image, 100, 260));
content.append("\n");
txtContent.setText(content);
}
Change to
publicvoidsetContent() {
SpannableStringBuilder content = new SpannableStringBuilder();
content.append(getImageSpannable(R.drawable.my_image, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
content.append("\n");
txtContent.setText(content);
}
And resize "R.drawable.my_image" dimensions
Post a Comment for "Imagespan Size Measurement With Textview And Staticlayout"