-1

This is the json response below from ifeng api.

enter image description here

Please help me how to show text object in a TextView including images in the middle.

AbhinayMe
  • 2,399
  • 1
  • 20
  • 21

4 Answers4

2

Use webwiev and load following json response(text witch are in html form) on webview.

Divyanshu
  • 462
  • 6
  • 17
2

Try This First pars that data ,then get text from text param

After getting the HTML text You need to use Html.fromHtml()

If your you are targeting < Android Nougat

yourTextView.setText(Html.fromHtml("PUT YOUR HTML CODE HERE"));

If your you are targeting >= Android Nougat

yourTextView.setText(Html.fromHtml("PUT YOUR HTML CODE HERE", Html.FROM_HTML_MODE_COMPACT));

Note:-

To distinguish between Android versions use Build.VERSION.SDK_INT >= Build.VERSION_CODES.N

Happy Coding!!

Arbaz.in
  • 1,478
  • 2
  • 19
  • 41
1

Try using TextView.setText(Html.fromHtml(...)), then using html tags in ..., but you need to implement Html.ImageGetter

Reference: https://stackoverflow.com/a/7442725/1636610

firemaples
  • 1,521
  • 13
  • 18
  • 1
    This link is more convenient & is working. Please check this answer. Thank you. stackoverflow.com/a/7442725/1636610 – AbhinayMe Sep 19 '18 at 09:02
  • 1
    The answer that you suggest is more clearing, I'll change the reference link in my answer to this one, thanks. – firemaples Sep 19 '18 at 09:27
0

you can show image in textview as drawable like below -

tvTitle.setText("Hi");
tvTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon, 0, 0, 0);//it will show icon image on left side of the text on tvTitle text view.
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. https://stackoverflow.com/review/low-quality-posts/20898900 – AbhinayMe Sep 19 '18 at 09:06