How to add vertical scroll bars on textarea in Act

2019-09-02 04:43发布

问题:

I wants to add vertical scroll bar in textarea spark component, i.e I want to show maximum 5 lines in textarea if text line will more than 5 then vertical scroll bar will automatically add and if i will reduce the text line then vertical scroll bar will automatically disappear.

My textarea code is :

<s:TextArea id="txtArea" width="{this.width}" height="3" borderVisible="false" focusAlpha="0.01" 
            selectionHighlighting="always" styleName="TextBox"
            needsSoftKeyboard="true" focusRect="false" direction="{textBoxDirction}" buttonMode="true" useHandCursor="true" mouseChildren="true"/>

I also tried to use verticalScrollPolicy = "on" and "off" but it is also not working.

So if anybody have an idea how to add vertical scroll bar in textarea please help me to solve this problem.

回答1:

Use

heightInLines="5"

instead of

height="3"


回答2:

Just put the mx:TextArea with width="100%" inside a mx:VBox container with a fixed height.