Pregunta

Here is my code :

<TextView
    android:id="@+id/text_view_title"
    android:layout_width="fill_parent"
    android:layout_height="40dp"
    android:layout_margin="5dp"
    android:ellipsize="end"
    android:maxLines="2"
    android:textSize="@dimen/text_size_small" />

In Android version 2.3.2, text is not showing in two lines, while in higher version device the text is showing in 2 lines. Also when I remove the tag ellipsize then text will be shown in 2 lines. How can I solve this issue?

¿Fue útil?

Solución

Remove the ellipsize tag. If you really want it for higher versions, add it programatically when you inflate the layout for android versions above 2.3.

Alternatively, use different layouts for 2.3 and before vs 3.0 and later. But that's more likely to lead to maintenance bugs. If this is the only difference I wouldn't go that route.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top