title: Android: Is there a way to use autoSize in a textView without breaking individual words?
body: <p>I'm trying to make an app (well, part of an app) which takes an input string from the user and displays it fullscreen, in a different fragment. Which I've got working, but using autoSize on it makes the text so big it gets wrapped, like this:
  <a href="https://i.stack.imgur.com/SfmKv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SfmKv.png" alt="Android screenshot showing the text &quot;Moo!!!!!!!&quot; split over multiple lines" /></a></p>
  <p>Not all words get broken if they're small enough:<br />
  <a href="https://i.stack.imgur.com/Asdne.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Asdne.png" alt="Android screenshot showing the text &quot;moooooooooo and again&quot;, with the extended &quot;moo&quot; being split over multiple lines" /></a></p>
  <p>Looking through the docs (and some web searching), these were the only XML attributes that seemed relevant:</p>
  <pre><code>android:breakStrategy=&quot;simple&quot;
  android:ellipsize=&quot;none&quot;
  android:hyphenationFrequency=&quot;none&quot;
  </code></pre>
  <p>None of them seemed to change the behaviour. About the only thing I could find that makes a difference is <code>android:singleLine=&quot;true&quot;</code> but that makes things worse:<br />
  <a href="https://i.stack.imgur.com/1yHqx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1yHqx.png" alt="Android screenshot showing the text &quot;Moo&quot; with only the first two letters visible" /></a><br />
  and I'm not sure I want to know how much worse that makes it when there's multiple words.</p>
  <p>I've pared the fragment layout down to basically the minimum possible that I can think of:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;FrameLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:layout_gravity=&quot;center&quot;&gt;
  
      &lt;TextView
          android:id=&quot;@+id/frag_big_text_text&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:background=&quot;@color/big_text_background&quot;
          android:gravity=&quot;center&quot;
          
          android:keepScreenOn=&quot;true&quot;
          android:clickable=&quot;true&quot;
          android:longClickable=&quot;true&quot;
          android:focusable=&quot;true&quot;
          android:textColor=&quot;@color/big_text_foreground&quot;
      
          android:breakStrategy=&quot;simple&quot;
          android:ellipsize=&quot;none&quot;
          android:hyphenationFrequency=&quot;none&quot;
          
          app:autoSizeTextType=&quot;uniform&quot;
          app:autoSizeMaxTextSize=&quot;240sp&quot;
          app:autoSizeMinTextSize=&quot;14sp&quot;
          app:autoSizeStepGranularity=&quot;1px&quot;
          
          tools:gravity=&quot;center&quot;
          tools:targetApi=&quot;m&quot;
          tools:text=&quot;BIG TEXT HERE&quot;/&gt;
      
  &lt;/FrameLayout&gt;
  </code></pre>
  <p>I know I could set the <code>autoSizeMaxTestSize</code> to something lower that should fit most phone screens, but then it won't fill the screen on a tablet (and don't worry about targeting <code>m</code>, my AVD is set to match the specs of my phone, which is on API 29). The code that sets the current text is also pretty simple:<code>bigTextView.text = messageList[index]</code> (and it's definitely not a problem with the list it's pulling from, since I tried hard coding it with <code>bigTextView.text = &quot;thisisareallylongword&quot;</code>, same result).</p>
  <p>I'm hoping this is one case where I'm missing something obvious and don't have to reinvent the wheel. Wheels aren't my area of expertise, I figured that out when I had to fix a broken <code>pip</code> install.</p>
  <p>But whatever reinvention or stupid intervention is required, can anyone help me out?</p>