TextView wrap text after changing font

I have this problem:

enter image description hereenter image description here

Well, the words in the article are ClickableSpans that change color and font when clicked. Because BOLD is slightly wider, some text at the end of the line exits the screen. Although you can scroll it sideways, I would still like to see abbreviated or hidden words go to the next line.

Is it possible? I tried by invalidate()resetting the width of the text again, but nothing helped me.

Thank!

+5
source share
4 answers

There may be several workouts in your problem.

Try using any of these attributes on TextView:

  • android:layout_weight=1
  • android:width="0dip"
  • android:ellipsize="none"
  • android:scrollHorizontally="false"

To view the scroll you can try:

<ScrollView android:id="@+id/SCROLL_VIEW"  
android:layout_height="fill_parent"   
android:layout_width="fill_parent">  

<TextView   
   android:id="@+id/TEXT_VIEW"   
   android:layout_height="wrap_content"   
   android:layout_width="wrap_content"   
   android:text="Here goes your text" />  
</ScrollView>

TextView . , , .

0

. , .

, requestLayout(), invalidate() .

0

TextView Layout, layout_width dip Layout layout_weight=1 TextView.

. , .

0

, , - textView.requestLayout()

0

All Articles