문제

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