如何在我的 xml 文件中实现这种设计?
How to achieve this design in my xml file?
如何在xml中实现这个设计,请帮忙。我在这个附件中描述了我想要的一切:
您可以通过重叠 ConstraintLayout
中的 TextView
并在第二个 TextView
中添加与第一个字母数量匹配的空格来实现此目的one. 或者您可以使用 one TextView
并对字符串的第一部分设置不同的样式。
作为参考,在 developer's website
上使用 HTML 检查样式字符串资源
例如:
textView.setText(Html.fromHtml("<b>Title</b>. The rest of your description"));
评论后更新:
<string name="first_item"><b>Title.</b> Rest of the description!</string>
然后以编程方式:
String text = getString(R.string.first_item);
Spanned styledText = Html.fromHtml(text, FROM_HTML_MODE_LEGACY);
如何在xml中实现这个设计,请帮忙。我在这个附件中描述了我想要的一切:
您可以通过重叠 或者您可以使用 one ConstraintLayout
中的 TextView
并在第二个 TextView
中添加与第一个字母数量匹配的空格来实现此目的one.TextView
并对字符串的第一部分设置不同的样式。
作为参考,在 developer's website
上使用 HTML 检查样式字符串资源例如:
textView.setText(Html.fromHtml("<b>Title</b>. The rest of your description"));
评论后更新:
<string name="first_item"><b>Title.</b> Rest of the description!</string>
然后以编程方式:
String text = getString(R.string.first_item);
Spanned styledText = Html.fromHtml(text, FROM_HTML_MODE_LEGACY);