使用标签宽度java android来安装文本

时间:2017-03-06 18:32:52

标签: java android

我需要在标签中显示字符串“hello i is programmer and make app for android”并使其符合标签宽度,如果字符串大于标签

示例显示“如果字符串大于标签宽度

,请问我是程序员并制作应用程序...”

2 个答案:

答案 0 :(得分:1)

initialState

答案 1 :(得分:0)

试试这个:

<TextView
            android:id="@+id/tv"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/red"
            android:ellipsize="end"    //add this
            android:maxLines="1"       //add this
            android:padding="5dp"
            android:scrollHorizontally="true"
            android:text="hello i am programmer and make app for android"
            android:textColor="@color/Black" />