Android RelativeLayout-按钮位于错误位置

Android RelativeLayout-按钮位于错误位置,android,eclipse,Android,Eclipse,我第一次使用RelativeLayout,并按如下方式放置了两个按钮: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" androi

我第一次使用RelativeLayout,并按如下方式放置了两个按钮:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageButton
        android:id="@+id/flybut"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="10dp"
        android:layout_centerVertical="true"
        android:background="#00000000"
        android:src="@drawable/flybut" />

    <ImageButton
        android:id="@+id/jumpbut"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/flybut"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="10dp"
        android:layout_marginBottom="10dp"
        android:background="#00000000"
        android:src="@drawable/jumpbut" />
</RelativeLayout>


因此,flybut位于屏幕左侧10dp处,实际上位于屏幕中央。跳线也位于屏幕左侧10dp in和飞线上方10dp处。在EclipseGUI中,这一切看起来与预期完全一样,但在运行时,jumpbut位于错误的位置。它从左边正确地是10dp英寸,但是它被卡在屏幕的最上面。我做错什么了吗?

确保父项占据屏幕的整个高度,如果它被定义为换行内容,则按钮将仅在它们所占据的空间居中…@Mikel:我不确定是否理解。。。我刚刚编辑了OP以显示整个xml。。这是否揭示了我的错误?“android:orientation=“vertical”不应该在这里用于RelativeLayout。这是为LinearLayout设计的。我说的你都明白了好吧,忽略评论…删除上面
android:layout_
中的
+
。这可能无法解决您的问题,但这是一种常见做法,因为您引用的是已创建的资源id。