【问题标题】:How to add indentation for TextView android如何为TextView android添加缩进
【发布时间】:2015-05-11 18:37:20
【问题描述】:

如何为TextViewandroid添加缩进?

1) 如何在TextView中查找字符串中的数字?
2) 如何添加这一行缩进,比如'\t'?

【问题讨论】:

  • 你尝试做什么?
  • 使用了LeadingMarginSpan2,但结果一般

标签: android layout textview


【解决方案1】:

您可能希望在垂直线性布局中创建多个TextView。 然后,您可以使用paddingLeftlayout_marginLeft 来缩进您的文本。

另一种可能是使用WebView,将您的文本设置为 HTML 并将其放入WebView

【讨论】:

  • 问题是,我不知道你要扔的原文是什么缩进,哪个不缩进。
  • 我不是要你计算缩进,我自己也可以。我只需要弄清楚如何添加符号“\t”的特定行
  • 使用TextView,你不能这样做:myTextView.setText("\tThis is an indented text"); ?
【解决方案2】:

你是想说你想在新点出现时添加 \t 吗? 例如: 1。 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxx

【讨论】:

  • 不是,这是,String=xxxxxxxxxxxxxxxxxxxSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSxxxxxxxxxxxxxxSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;当我在 TextView 中添加文本时。显示器不同。在单个显示器上,文本将来自 5 行,其他 10 行。我只是在每一行中添加空间。怎么办?
猜你喜欢
  • 2015-07-22
  • 2014-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-16
  • 1970-01-01
  • 2011-03-13
  • 1970-01-01
相关资源
最近更新 更多