Android layout 为什么相对布局将所有图片都放在中屏幕上

Android layout 为什么相对布局将所有图片都放在中屏幕上,android-layout,Android Layout,我试图在相对视图中控制活动上图像的位置。 但不管我做什么。PIC总是出现在屏幕中间。 <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="100dp" android:layout_marginTop="1dp" android:src="@drawabl

我试图在相对视图中控制活动上图像的位置。 但不管我做什么。PIC总是出现在屏幕中间。

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_marginTop="1dp"

        android:src="@drawable/hp" />

</RelativeLayout>


尽管我尝试了对齐和我能想到的一切。

示例

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_marginTop="1dp"

        android:src="@drawable/hp" />

</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" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@android:drawable/btn_star" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageView1"
        android:layout_toRightOf="@+id/imageView1"
        android:src="@android:drawable/btn_star_big_on" />

</RelativeLayout>
两颗星。一个相对于父级(绑定到左上角),另一个相对于第一颗星(绑定到左上角到第一颗星-请参见下面的
layout\u
layout\u toRightOf

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_marginTop="1dp"

        android:src="@drawable/hp" />

</RelativeLayout>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_marginTop="1dp"

        android:src="@drawable/hp" />

</RelativeLayout>
来源

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_marginTop="1dp"

        android:src="@drawable/hp" />

</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" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:src="@android:drawable/btn_star" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imageView1"
        android:layout_toRightOf="@+id/imageView1"
        android:src="@android:drawable/btn_star_big_on" />

</RelativeLayout>


请提供完整的XML布局资源,并命名“您能想到的一切”包括的内容。我将我能想到的一切都放在imageView中。也许我只是做错了什么,你从相对的布局中控制了imageview?有一种简单的方法将图片与屏幕顶部对齐……这是您的整个XML文件吗?它是畸形的;让我惊讶的是,安卓没有抱怨。