我的布局有问题。我有这个结构:
<ScrollView>
    <LinarLayout>
        <Button/>
        <RelativeLayout>
            <ImageButton/>
            <ImageButton/>
            <ImageButton/>
        </RelativeLayout>
    </LinarLayout>
</ScrollView>
我希望三个 ImageButtons 居中,一个相邻,如下所示:
IMG1   IMG2   IMG3
为此,我将元素集中在RelativeLayoutusing 中android:gravity="center",android:layout_toRightOf="@+id/element"并android:layout_toLeftOf="@+id/element"以我想要的方式对元素进行排序。
当我检查GraphicalLayout选项的结果时,它准确地显示了我想要的(我从来没有遇到过这个视图的问题,它总是显示我在 XML 文件上写入的元素)但是然后我编译并执行,这就是全部无序的。我尝试了很多不同的方式来订购元素,但它正在做它想做的事......这是我近两年的开发中第一次发生这种情况。
我也关闭了 Eclipse,但没有任何改变。
编辑以添加信息
我希望元素是这样的:
IMG1   IMG2   IMG3
在 GraphicalLayout 中一切正常,但在模拟器中,三个 IMGS 重叠。
这是完整的代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bugbox_wall_port" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >
        <Button
            android:id="@+id/writeNewMsg"
            android:layout_margin="10dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="New" />
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:padding="10dp" >
            <ImageButton
                android:id="@+id/spyMsgs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/msgspy" />
            <ImageButton
                android:id="@+id/playerMsgs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/msgplyr"
                android:layout_toRightOf="@+id/spyMsgs" />
            <ImageButton
                android:id="@+id/allyMsgs"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/msgally"
                android:layout_toRightOf="@+id/playerMsgs" />
        </RelativeLayout>
    </LinearLayout>
</ScrollView>
我不知道如何解决它。快把我逼疯了。这种布局有什么问题?为什么元素没有排序?我该如何解决它并像往常一样订购元素?
有人能帮我吗?
先感谢您!
