Android ImageView位置不正确

Android ImageView位置不正确,android,imageview,Android,Imageview,我试图从internet加载图像并将其放入图像视图,但我想使用屏幕宽度作为图像的宽度,并保持纵横比。我已经在stackoverflow上尝试了所有的解决方案,但都没有用。我想是因为我正在从互联网加载图像,并将其放入ImageView 这是xml文件 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/too

我试图从internet加载图像并将其放入
图像视图
,但我想使用屏幕宽度作为图像的宽度,并保持纵横比。我已经在stackoverflow上尝试了所有的解决方案,但都没有用。我想是因为我正在从互联网加载图像,并将其放入
ImageView

这是xml文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    tools:context=".ViewPhoto"
    android:background="@color/darkgrey"
    android:id="@+id/layout"
    >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:id="@+id/title" 
        android:background="@color/Black"
        android:typeface="sans"
        android:textColor="@color/White"
        />

    <ImageView 
        ??

        />

     <ListView
        android:id="@+id/comments"
        android:layout_below="@+id/photo"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:divider="#b5b5b5"
        android:dividerHeight="2dp"               
        />

</RelativeLayout>



试着这样做吧

试着在你的
图像视图中使用
android:scaleType=“centerCrop”

r你没有得到正确的纵横比,是吗???现在宽度不是屏幕宽度,当我使用
android:layout\u width=“fill\u parent”
时,高度不再正确。非常奇怪,宽度不是屏幕宽度,当我使用android:layout\u width=“fill\u parent”
时,高度不再正确。设备的dpi是多少,图像的分辨率是多少。我的dpi是320,分辨率256×192将您的图像放入dwrable xhdpi文件夹,告诉我发生了什么。现在纵横比保持不变,但我无法向下滚动到照片的底部。宽度可以。
   <ImageView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:layout_below="@id/title"
    />