title: How do I keep the aspect ratio on image buttons in android?
body: <p>I have 5 square ImageButtons that I want to have lined up side by side on the bottom of the screen.  I have each one set (different id's) as: </p>
  
  <pre><code>        &lt;ImageButton
           android:id="@+id/box1" 
           android:layout_width="fill_parent"
           android:layout_height="wrap_content" 
           android:layout_gravity="center"
           android:adjustViewBounds="true"
           android:scaleType="fitXY"
           android:layout_weight="1"
           android:layout_margin="1dp"
           /&gt; 
  </code></pre>
  
  <p>and I have the background assigned in main java like this:</p>
  
  <pre><code>    int[] imageIds = new int[] {R.id.box1,R.id.box2,R.id.box3,R.id.box4,R.id.box5};
      for(int i = 0; i&lt;5; i++){
          imageButtons[i] = (ImageButton) findViewById(imageIds[i]);
          imageButtons[i].setBackgroundResource(R.drawable.blank);
      }
  </code></pre>
  
  <p>What I would like to have it do is scale the width to fit neatly side-by-side at the bottom of the screen (which it does now ok), but have the height automatically scale to match the width as well. is this possible?  I don't want to use setImageSource because then it puts a border around the imagebutton.</p>