Unrealxqt
Unrealxqt

Reputation: 17

How to move ImageButtons

I am working on an application for Android in Eclipse, but I have some problems with the look of the menu. I have several buttons that people can click and play sounds with them. The problem is that I don't know how to start a new line and go on with more buttons.

I'll post two images. I think the image title will tell you everything.

1st:

http://postimg.org/image/gv54y5dcb/


2nd:

http://postimg.org/image/l1exyea09/


The 2nd image is made with PhotoShop.

XML:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="665dp"
            android:orientation="horizontal" >

            <ImageButton
                android:id="@+id/aatrox_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/aatrox" />

            <ImageButton
                android:id="@+id/ahri_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ahri" />

            <ImageButton
                android:id="@+id/akali_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/akali" />

            <ImageButton
                android:id="@+id/alistar_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/alistar" />

            <ImageButton
                android:id="@+id/amumu_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/amumu" />

            <ImageButton
                android:id="@+id/anivia_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/anivia" />



            <ImageButton
                android:id="@+id/annie_imgbutton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/annie" />




        </LinearLayout>
    </ScrollView>

    <Button
        android:id="@+id/back_champions"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="50dp"
        android:text="@string/back" />

</LinearLayout>

I tried moving the image buttons with the mouse but no success.

Upvotes: 0

Views: 83

Answers (1)

Sush
Sush

Reputation: 3874

you need grid view. check out sample grid view sample

Upvotes: 1

Related Questions