title: Get 4 Buttons to have the same autoSize Android (Kotlin)
body: <p>so I am trying to build a UI for my Android-App that should look similar <a href="https://i.stack.imgur.com/63a8q.png" rel="nofollow noreferrer">to this picture</a>. The problem is that the <code>textSize</code> of them is obviously different because the length of the strings is different, but I need them to be the same size. I found two solutions:</p>
  
  <ol>
  <li><p>Leave them like this, get the four sizes and choose the smallest for them (still using the a <code>autoSizeTextType="uniform"</code> provided by Android)</p></li>
  <li><p>Loop through the textsizes for all the buttons until the <code>lineCount</code> is greater than one and choose the smallest once again</p></li>
  </ol>
  
  <p>The problem is that both need the Layout fully loaded. If it isn’t fully loaded all three autosized Buttons will return the same size or <code>lineCount</code> will return 0 (I am aware that there is a solution here on StackOverflow but it doesn't work for me).</p>
  
  <p>I am aware that the lifecycle (<a href="https://developer.android.com/guide/components/activities/activity-lifecycle" rel="nofollow noreferrer">https://developer.android.com/guide/components/activities/activity-lifecycle</a>) specifies that the Activity should be fully loaded <code>onReasume()</code> but that isn’t true as well.</p>
  
  <p>Do you guys know a better solution than the two of mine or how to get them to work?</p>
  
  <p>Here is my XML-File:
      
      </p>
  
  <pre><code>&lt;androidx.constraintlayout.widget.Guideline
      android:id="@+id/guideline"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      app:layout_constraintGuide_percent="0.5" /&gt;
  
  &lt;androidx.constraintlayout.widget.Guideline
      android:id="@+id/guideline2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:orientation="vertical"
      app:layout_constraintGuide_percent="0.5" /&gt;
  
  &lt;Button
      android:id="@+id/btn_1"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:background="#009688"
      android:autoSizeTextType="uniform"
      android:maxLines="1"
      android:text="12"
      app:layout_constraintBottom_toTopOf="@+id/guideline"
      app:layout_constraintEnd_toStartOf="@+id/guideline2"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/btn_2"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:background="#E91E63"
      android:autoSizeTextType="uniform"
      android:maxLines="1"
      android:text="Test12"
      app:layout_constraintBottom_toTopOf="@+id/guideline"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="@+id/guideline2"
      app:layout_constraintTop_toTopOf="parent" /&gt;
  
  &lt;Button
      android:id="@+id/btn_3"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:background="#FF5722"
      android:autoSizeTextType="uniform"
      android:maxLines="1"
      android:text="Hi"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toStartOf="@+id/guideline2"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toTopOf="@+id/guideline" /&gt;
  
  &lt;Button
      android:id="@+id/btn_4"
      android:layout_width="0dp"
      android:layout_height="0dp"
      android:background="#673AB7"
      android:autoSizeTextType="uniform"
      android:maxLines="1"
      android:text="Hello World"
      app:layout_constraintBottom_toBottomOf="parent"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="@+id/guideline2"
      app:layout_constraintTop_toTopOf="@+id/guideline" /&gt;
  </code></pre>
  
  <p>
  MainActivity:    </p>
  
  <pre><code>package com.example.testsizes
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import kotlinx.android.synthetic.main.activity_main.*
  
  
  
  class MainActivity : AppCompatActivity(){
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
      }
  }
  </code></pre>
  
  <p>Thanks in advance!</p>