简体   繁体   English

Textview中HTML内容的高度-Android

[英]Height in HTML Content in Textview - Android

Good day! 美好的一天!

I have an application that uses html.fromhtml() to style my paragraph content. 我有一个使用html.fromhtml()设置段落内容样式的应用程序。

But i don't have any control of the <br> or the <p> tag in terms of the spacing (vertical) they created since css is not working in android. 但是我没有对<br><p>标记的间距(垂直)进行控制,因为CSS无法在android中工作。

Is there anyway how to do it? 反正有怎么做呢?

Here is my code so far: 到目前为止,这是我的代码:

 con.setText(Html.fromHtml("<b>Lorem Ipsum Dolor</b><br/><br/>" +
            "<p>Lorem Ipsum Dolor</p>"+
            "<p>Crest PTY 1000</p>" +
            "<p>Phone: (02) 8217-1300</p>"+
            "<p>BSB 032-0052</p><br/>" +            
            "<b>Trading Hours</b><br/><br/>"+
            "<p>Monday – Thursday 9:30am – 4:00pm</p>" +            
            "<p>Friday 9:30am – 5:00pm<br/></p>" +
            "<p>Saturday 10:00am – 1:00pm</p><br/>"+            
            "<b>Languages</b><br/><br/>"+
            "Mandarin, Cantonese, Bahasa Indonesia,<br/><br/> Japanese, Vietnamese, Greek<br/><br/><br/>"+          
            "<b>Morning Style</b><br/><br/>"+           
            "Safe deposit box - This one<br/>"+
            "Internet Banking kiosks<br/>"+
            "Night safe<br/>" +
            "Coin Deposit Machine<br/>" +
            "Cash Exchange Machine<br/>" +
            "Migrant Services<br/><br/>"));

Screenshot 屏幕截图

在此处输入图片说明

Any help is very much appreciated 很感谢任何形式的帮助

You can set the line spacing of a TextView by using: 您可以使用以下方法设置TextView的行距:
con.setLineSpacing(5, 1);

TextView.setLineSpacing(float, float) TextView.setLineSpacing(float,float)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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