android TextView设置字过多长长度后面显示省略号失效


<TextView
    android:id="@+id/homework_name"
    android:layout_width="wrap_content"
    android:layout_height="30dp"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/homework_classname"
    android:layout_toRightOf="@+id/homework"
    android:layout_marginLeft="10dp"
    android:ellipsize="end"
    android:maxEms="12"
    android:singleLine="true"
    android:text=""
    android:textColor="@color/black6"
    android:textSize="16sp" />

设置了   

android:ellipsize="end"
        android:maxEms="12"
        android:singleLine="true"    三个属性,但是 没有出现 到一定字符长度之后进行限制。经测试,把 toRightOf 这个属性去了就有了。 应该是  toRightOf 在布局中的权重比 maxEms 这三个组合的高。 去掉就OK 了

你可能感兴趣的:(android TextView设置字过多长长度后面显示省略号失效)