0

The text inside the textview breaks with hyphen on different devices. It works fine on most devices. How can I stop the text from breaking? I'm using different dimens.

This is my code for the textbox,

<TextView
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:gravity="center_horizontal"
     android:lines="2"
     android:text="Medical History"
     android:textSize="@dimen/text_label" />

These are the values of text_label:

<dimen name="text_label">16sp</dimen> 
<dimen name="text_label">19.2sp</dimen> //hdpi
<dimen name="text_label">22.4sp</dimen> //xhdpi
<dimen name="text_label">25.6sp</dimen> //xxhdpi
<dimen name="text_label">28.8sp</dimen> //xxxhdpi

What I want:

Medical
History

What I have:

Medical Hi-
story

What I want:

Medication

What I have:

Medica-
tion

Kate Lastimosa
  • 169
  • 2
  • 15

1 Answers1

0

I think you just need to add this in your TextView's XML

 android:breakStrategy="simple"

Read more about it here

Harsha Vardhan
  • 446
  • 4
  • 15