Android XML Layout with imagebuttons in a row



Im trying to create a row of image buttons, so lets say 3 rows and 3 columns.


I keep trying to make the images all the same size but the design just messes up.


Trying to get something like this:


Image Image Image


Image Image Image


Image Image Image


Can someone help me get these in line?



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">

<ImageButton
android:layout_width="100dp"
android:layout_height="172dp"
android:id="@+id/imageButton"
android:src="@drawable/sample_0"
android:layout_gravity="center_horizontal" />

<ImageButton
android:layout_width="129dp"
android:layout_height="180dp"
android:id="@+id/imageButton2"
android:src="@drawable/sample_1" />

</LinearLayout>

No comments:

Post a Comment