Pergunta

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" />
Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top