I would like to have a text displayed on an Android widget (remote views) not wrap over its text to the next line, if the text is longer than the Textview's width. Instead of that, I would like to have the Textview cut any extra text. I have tried many things without success.

Here is the XML code for the TextView:

    <TextView
        android:id="@+id/txtInformation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dp"
        android:maxWidth="220dp"
        android:lines="1"
        android:text="Long text long text long text long text"
        android:textSize="13sp" />
有帮助吗?

解决方案

In your layout XML, use android:maxLines="1" or android:singleLine="true"

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top