Android:TextView最小行数设置

我们有时候为了保证TextView必须有一个最小的高度,那么就需要设置这个行数。

因为如果你不设置的话,在measure这个TextView的时候,此时就无法准确的得到一个最小高度。因为设备不同,所以必须measure(0,0)来获取到。

默认TextView的高度是1行。

    <TextView
       android:background="#220000ff"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:lines="8"
        android:text="hahaha" />

 

posted on 2016-11-26 23:46  放纵的卡尔  阅读(1674)  评论(0编辑  收藏  举报

导航