TextView 最多顯示2行,每行最多10個字,多餘的顯示....

 

<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:lines="2"
        android:maxEms="10"
        android:ellipsize="end"
        android:paddingTop="10dp"
        android:text="@string/search_info"
        android:textColor="@color/white"
        android:textSize="10dp" />

 

android:lines=”1”:只顯示一行 
android:ellipsize=”end”:超出部分顯示省略號… 
android:maxEms=”8”:可以參見這位同學的實驗 ,url 地址

設你輸入的參數爲n, textview顯示的數量爲m。 
值爲1-5時,m = n.. 
6-11時,m = n+1。 
12-18時,m = n+2。

尊重作者勞動成果:https://blog.csdn.net/u012060443/article/details/71633950

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章