I have a footer, where I need to place my 3 buttons horizontally (left, center and right - like I divide the width of the screen in 3 pieces each one for each button, but with margins between the buttons). I need to put one image to cover each button, and the buttons should have the shape that my images have (not scaled). The problem I have, is that I use imagebuttons in order to put my image on each button and when I change device to see how it looks like there, I see my buttons scaled. It is so annoying and I really don't know what to do. I use weightsum. My code is this:
<RelativeLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:layout_alignParentBottom="true"
android:background="@color/black">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton1"
android:background="@drawable/image1"
android:layout_gravity="left"
android:layout_marginRight="20dp"
android:layout_weight="1"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton2"
android:background="@drawable/image2"
android:layout_gravity="left"
android:layout_marginRight="20dp"
android:layout_weight="1"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton3"
android:background="@drawable/image3"
android:layout_gravity="right"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
Even like that, in my current device, I have to put specific margins between the buttons in order to not see the images scaled. And I am not sure if they are scaled at the end.
I would like one solution that will make me able to have the 3 images not scaled in any device and to have the margin they should have in each device, according to the size of each device.
Thank you very much in advance!!