0

I have a TextView that when it has a long text, it resizes to make the text fit inside, breaking the UI.

Is there a way to use a XML attribute to make the TextView not resizable?

I was thinking about using the TextView inside a ScrollView, is there other options?

RominaV
  • 3,335
  • 1
  • 29
  • 59

3 Answers3

1

For this to work, set specific width to textview (It will display textview without scroll)

android:layout_width=""

If you want to show scroll, add scrollview with specific size and inside scroll layout, add textview like

<ScrollView
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:id="@+id/scrollView"
    android:fillViewport="false">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</ScrollView>

100dp is dummy size here.

Paritosh
  • 2,097
  • 3
  • 30
  • 42
0

Solution :

<TextView
  android:elipsize="marquee"

</TextView>

check out this Answer for more options : Elipsize Examples

this will slide the textView

Community
  • 1
  • 1
Itzik Samara
  • 2,278
  • 1
  • 14
  • 18
0

Try this code:

<TextView
android:layout_width="100dp" 
android:layout_height="wrap_content" 
android:singleLine="false" 
android:singleLine="false" 
android:text="Long multiline text"/>
QArea
  • 4,955
  • 1
  • 12
  • 22