I have a layout problem, I want an image to be in the middle of two buttons. So I created the two buttons and defined a weightSum of 1. I then set the weight of the two buttons to .40 and the image to .20 so that the image would be a small logo in the middle of the two buttons. The problem is the image is stretched out and the buttons are pushed aside.
<Button
android:id="@+id/buttonClear"
style="@style/ButtonText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".40"
android:background="@drawable/custombuttonred"
android:text="@string/clear"
android:textSize="50sp" />
<ImageView
android:id="@+id/myimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:src="@drawable/imageid" />
<Button
android:id="@+id/buttonBackspace"
style="@style/ButtonText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight=".40"
android:background="@drawable/custombuttonred"
android:text="@string/backspace"
android:textSize="20sp" />
I had also faced the same issue. I used the button insted of ImageView and set background image to it.