title: Force Android Button to Stay Square
body: <p>I am reopening a question that was asked two years (and yes, I tried all the answers but there was no joy). The question asked two years ago: <a href="https://stackoverflow.com/questions/9852568/imagebutton-force-square-icon-height-wrap-content-width">ImageButton: Force square icon (height = WRAP_CONTENT, width = ?)</a></p>
  
  <p>I am faced with the same situation where I am attempting to align a Button (with a background image) with an EditText. The following is what I am trying to accomplish:</p>
  
  <p><img src="https://i.stack.imgur.com/Ckxgs.png" alt="Desired outcome"></p>
  
  <p>The RelativeLayout I am using is:</p>
  
  <pre><code>&lt;EditText
      android:id="@+id/search_entry"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="@dimen/search_layout_height"
      android:layout_marginLeft="@dimen/search_layout_left"
      android:padding="@dimen/small_padding"    
      android:background="@drawable/search_box"
      android:inputType="text|number"
      android:textSize="@dimen/small_textsize"
      android:hint="@string/search_for_hint" 
      android:textColorHint="@color/mdgray"
      android:imeOptions="actionSend" /&gt;
  
  &lt;Button
      android:id="@+id/search_btn"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignBottom="@id/search_entry"
      android:layout_alignTop="@id/search_entry"
      android:layout_toRightOf="@id/search_entry"
      android:adjustViewBounds="true"
      android:scaleType="centerInside"
      android:background="@drawable/search_btn" /&gt;
  </code></pre>
  
  <p>However, what I am ending up with is:</p>
  
  <p><img src="https://i.stack.imgur.com/M4uds.png" alt="Current Outcome"></p>
  
  <p>As you can see, it wants to stretch laterally.</p>
  
  <p>Thoughts on how to make sure the button stays square?</p>