Question

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" />
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top