如何为Android应用程序正确缩放图像?

如何为Android应用程序正确缩放图像?,android,image,scale,android-imageview,Android,Image,Scale,Android Imageview,我不知道如何在android中正确缩放图像。 我有一张640*125像素的iPhone应用图片。我需要用这个 一个Android应用程序,但我不知道如何正确缩放它 在下面的图像中,我使用“FitEnd”作为ScaleType,这看起来与高度无关 大约是其大小的两倍(仅应与灰色图形的最高部分一样高) 我该如何解决这个问题 编辑:包括.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:

我不知道如何在android中正确缩放图像。 我有一张640*125像素的iPhone应用图片。我需要用这个 一个Android应用程序,但我不知道如何正确缩放它

在下面的图像中,我使用“FitEnd”作为ScaleType,这看起来与高度无关 大约是其大小的两倍(仅应与灰色图形的最高部分一样高)

我该如何解决这个问题

编辑:包括.xml

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

        <ViewFlipper
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/buttonrow" >

            <ViewFlipper
                android:id="@+id/flipper"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >

                <include
                    android:id="@+id/first"
                    layout="@layout/activity_events" />
                <include
                    android:id="@+id/second"
                    layout="@layout/event_detail" />
            </ViewFlipper>  
            <include
                android:id="@+id/second"
                layout="@layout/event_detail" />
        </ViewFlipper>

        <RelativeLayout
            android:id="@+id/buttonrow"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:scaleType="fitEnd"
                android:src="@drawable/bottombar" />


        </RelativeLayout>

    </RelativeLayout>

我有两个版本:

  • 图像具有不透明背景。图像参数正常,问题出在你的照片上

  • 如果不是第一个版本,请向我显示您的.xml文件


  • 该图像有透明的背景,我已经编辑了我的文章并包含了.xml文件。