简体   繁体   中英

Set text above image in TextView using HTML

I have a list of Strings that I add to TextViews one by one. The text is html so I can add images within the text. So my question is... How can I add an Image so that the text appears above it. currently while using HTML.ImageGetter class text is added below the image, not above it: Here is my Html text to be shown:

myText += "<img src='titles.png'><span> text to be above image </span>";

Please try following code as example(Html text is changed):

myText += "<div style='position: relative;width: 100%;'> <img src='titles.png'><span style='position: absolute;top: 100px;left: 0;width: 100%;'> text to be above image </span></div>";

I referred http://css-tricks.com/text-blocks-over-image/ for checking for css properties. Hope this is helpful for you.

Thanks & Regards,

Chanchal

you can add a simple alt="texthover" to the anchor tag and it will display the text in the alt in most browsers.

But that is not as good as creating an a.hover class that would display text or a div that has text.

Does that help?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM