[英]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.