开发者

How to wrap text to next line in an Android TextView?

I am using following TextView to display 开发者_开发知识库some data in it:

<TextView android:id="@+id/notificationText" 
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:textSize="18sp"
        android:inputType="textMultiLine"
        android:maxLines="2"
        android:layout_paddingRight="20dip"
        android:textColor="#ffffff"/>

I want to wrap text to next line. How can I do this?


you must set android:scrollHorizontally="false" in your xml.


In Some case It works by setting width to 0dp on text views.

android:layout_width="0dp"

here is a link to original answer.


You could also try

android:inputType="textMultiLine"

in your XML. This worked for me.


You need to set

 android:minLines="2"
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜