title: How to find width of item in recyclerview?
body: <p>I have a <code>recyclerview</code> which is just a horizontal list of buttons. I am trying to create the following behavior:</p>
  
  <p>If the total width of all of the buttons combined is less than the total width of the screen, set the width of each button to (screenWidth/number of buttons). </p>
  
  <p>I am testing some basic code to get/set button widths like so in my <code>adapter</code> class: </p>
  
  <pre><code> override fun onBindViewHolder(holder: TabViewHolder, position: Int) {
  
          Log.d("TEST-APP","Button Width: " + holder.button.width.toString())
  
          holder.button.width = 1080
  
          Log.d("VED-APP","New Button Width: " + holder.button.width.toString())
  
          holder.button.text = items[position].first
          holder.button.setOnClickListener {
              (context as MainActivity).updateCurrentImageLayout(items[position].second)
          }
      }
  </code></pre>
  
  <p>The odd thing is, while this code does actually change the width of the button to 1080 the outputs of the two <code>Log</code> functions before/after setting the button width are both 0. </p>
  
  <p>How do I get the actual width of the button? </p>
  
  <p>Here is my layout which defines one column in my <code>recyclerview</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"&gt;
  
      &lt;Button
          android:id="@+id/tabButton"
          android:layout_width="match_parent"
          android:minWidth="120dp"
          android:layout_height="match_parent"
          android:text="Unset-Button-Text"/&gt;
  
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>