Android:带有标题和文本正文的滚动视图 [英] Android: scroll view with titles and text bodies
本文介绍了Android:带有标题和文本正文的滚动视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一个简单的帮助屏幕,如下所示.我需要有 8 个不同的标题,它们下方的文本正文较小.我已经实现了滚动视图,但如何改变字体大小?
I'm trying to create a simple help screen that looks like the the one shown below. I need to have 8 different titles with smaller sized text bodies below them. I have implemented a scroll view, but how do I vary the font sizes?
推荐答案
利用 TextView 能够呈现有限的 HTML 标记集这一事实,您可以在单个 TextView 中获得类似的结果.例如
You can get a similar result in a single TextView by taking advantage of the fact that the TextView has the ability to present a limited set of HTML markup. For example
TextView t = (TextView)findViewById(R.id.text1);
t.setText(Html.fromHtml("<H1><u><em>Title1</em></u></H1>Details for section 1<H1><u><em>Title2</em></u></H1>Detail for Section 2"));
将使用 Title1 作为较大的字体部分标题呈现到 TextView 中,粗体和下划线.
Will render into the TextView with Title1 as a larger font section header, bold and underlined.
这可能满足您的申请.
这篇关于Android:带有标题和文本正文的滚动视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文