[英]How to scale image correctly for Android app?
我不明白如何在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文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.