开发者

How can you tab in the first line of a paragraph of text

开发者 https://www.devze.com 2023-02-22 18:15 出处:网络
I have some text that is passed dynamically, but the design of the text requires that the top line is tabbed in, so it looks like this:

I have some text that is passed dynamically, but the design of the text requires that the top line is tabbed in, so it looks like this:

Stackover flow rules, Stackover flow rules,
开发者_如何学Python

Stackover flow rules, Stackover flow rules, Stackover flow rules,

Could I use HTML special characters to do this?

Stephen


You could enter text that has a "\t" (TAB) character as the first character of the first line. And make sure your textfield has a textformat with tab stops in it.

I did it recently like this:

        var tf:TextFormat = _textField.defaultTextFormat;
        tf.tabStops = [20]; // make the indentation 20 px
        _textField.defaultTextFormat = tf;
        _textField.text = "\t"+text;


First, you should specify what text container you use. For p html tag, there is text-indent property to indent first line. Alternatively, you can use   characters.

0

精彩评论

暂无评论...
验证码 换一张
取 消