singleline设置为true,则可以实现单行显示
ellipsize则是控制省略号的位置,分别有start(开始),middle(中间),end(最后),marquee(跑马灯)。
代码展示:
<TextView
android:id="@+id/music_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold" />
如果指定了,左右两侧的控件,通过这两个属性,则会在这两个控件之间显示省略号