Limit numbers of lines in TextView

后端 未结 7 1268
忘掉有多难
忘掉有多难 2021-02-01 01:14

I have a scrollable textView, and I want to limit the number of lines displayed, however xml properties are not working :



        
相关标签:
7条回答
  • 2021-02-01 02:20

    put your text view with in scroll view and set fixed height of scroll view.

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="120dip" >
    
        <TextView
            android:id="@+id/tv_addesc"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:maxLines="12"
            android:scrollbars="vertical"
            android:textColor="#FFFFFFFF"
            android:textSize="15sp" />
    </ScrollView>
    

    set properties as per your need

    0 讨论(0)
提交回复
热议问题