This should be easy, but everything I try is not quite right.  I want
to use an XML RelativeLayout to position 5 square ImageButtons along
the bottom of the screen.  The images are defined by a 120 x 120 pixel
PNG, so it needs to be scaled down to fit in a Droid in portrait mode,
for instance.  I have tried specify for each button:

  android:layout_weight="1"
  android:layout_width="50px"
  android:layout_height="50px"
  android:scaleType="fitXY"

The layout_weight="1" is necessary to make the buttons spread out
horizontally and share the space.  Otherwise they bunch up at the
beginning.

The layout_width and layout_height are arbitrary, but they are
necessary to keep the program from crashing.

the scaleType of "fitXY" is necessary to make the image scale down to
the laid out size of the button.   But it only scales in X.  It leaves
Y at 50px because that was my arbitrary setting.  I want the
ImageButton to remain square, so I need the X and Y sizes to be the
same.  I don't know how to do that in XML without specifying them
explicitly, and I don't want to do that because I want the X sizes to
be set by dividing up the available width evenly in the layout
process.  I am willing to do some adjustments in onCreate, but what
can I do to force the 1:1 aspect ratio of the buttons and still
benefit from convenience of XML layout?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to