且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android的滚动显示多行文本?

更新时间:2023-12-04 14:15:22

您可以限制的TextView 的高度来匹配你的用户希望看到的行数,然后简单地把你的的TextView 滚动型

You can limit the Height of TextView to match the number of lines you user wants to see, then simply put your TextView in a ScrollView

我做了一个简单的例子来证明这一点......

I had done a simple example to demonstrate this...

<ScrollView android:layout_height="30dp"
        android:layout_width="match_parent">
<TextView 
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:textSize="16sp"
    android:id="@+id/tv1"
    />
</ScrollView>