如何在中间的文本视图(段落)中开始第一行-android
我是安卓新手。我有一段string如下所示
String my_paragraph ="Software is a set of instructions, data or programs used to operate computers and execute specific tasks. It is the opposite of hardware, which describes the physical aspects of a computer. Software is a generic term used to refer to applications, scripts and programs that run on a device."
textView.setText(my_paragraph);
我想在文本视图中显示它,如下图所示:
但我得到的是我在下面添加的
我希望文本视图(段落)中的第一行应该从中间开始。我不想在string. 我不知道如何实现这一目标。请帮我解决一些问题。
回答
Android 拥有可以为您执行此操作的库。我找到了一篇关于如何使用SpannableString和LeadingMarginSpan库的旧帖子。
可以在以下位置找到问题:Android 中的领先利润率是多少?
- i think this is the best solution you'll find for this, but i wouldn't consider this question a duplicate of the one you've mentioned here. good find