如何移动ImageButtons

时间:2013-12-30 11:20:36

标签: android xml android-layout

我正在使用Eclipse中的Android应用程序,但是我对菜单的外观有些问题。我有几个按钮,人们可以点击并播放声音。问题是我不知道如何开始一个新行并继续使用更多按钮。

我会发布两张图片。我认为图像标题会告诉你一切。

第一名:

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


第二名:

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


第二张图片是用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>

我尝试用鼠标移动图像按钮但没有成功。

1 个答案:

答案 0 :(得分:1)

你需要网格视图。看看样品 grid view sample