android图像覆盖中的XML布局

android图像覆盖中的XML布局,android,Android,我已经尝试过这个代码,并且工作正常。有什么建议吗??输出的图像正好位于图像下方。。我希望将图像稍微放在image1的下方将您的XML文件替换为 <LinearLayout> android:id="@+id/row2" android:layout_width="match_parent" android:layout_height="match_parent"

我已经尝试过这个代码,并且工作正常。有什么建议吗??输出的图像正好位于图像下方。。我希望将图像稍微放在image1的下方

将您的XML文件替换为

 <LinearLayout>
                    android:id="@+id/row2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >

                    <ImageView
                        android:id="@+id/ImageView1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:src="@drawable/card1" />

                    <ImageView
                        android:id="@+id/ImageView2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:src="@drawable/cardshadow"/>
    </LinearLayout>
在布局标签中使用此选项


android:orientation=vertical

我认为这不合适。你过早地关闭了LinearLayout标签如果你想增加一些边距,就我从你措辞拙劣的问题中所理解的,给底部的图片加一个边距,给顶部的图片加一个边距。谢谢你的回答!!!它在ide的图形布局中运行良好,但在android sdk中不起作用…以及如何将图像居中。。。我需要将第一个时间居中…???在相对布局中添加android:gravity=center,请参阅我更新的ans Not working android:Layout\u gravity=center\u horizontal和gravity:center…。还有其他答案吗。。。????
<RelativeLayout
        android:id="@+id/row2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center" >

        <ImageView
            android:id="@+id/ImageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:src="@drawable/card1" />

        <ImageView
            android:id="@+id/ImageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginTop="15dp"
            android:src="@drawable/cardshadow" />

    </RelativeLayout>