Java 使用标签宽度调整文本
我需要在标签中显示字符串“你好,我是程序员,为android制作应用程序”,如果字符串比标签大,则使用标签宽度进行调整 示例显示“hello i am programmer and make app…”如果字符串大于标签宽度,请尝试以下操作:Java 使用标签宽度调整文本,java,android,Java,Android,我需要在标签中显示字符串“你好,我是程序员,为android制作应用程序”,如果字符串比标签大,则使用标签宽度进行调整 示例显示“hello i am programmer and make app…”如果字符串大于标签宽度,请尝试以下操作: <TextView android:id="@+id/tv" android:layout_width="match_parent" android:layout_height=
<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" />
use this
android:ellipsize="end"
android:maxLines="1"
android:maxLength="25"