2015-04-23 55 views
0

我爲我的應用程序實現啓動屏幕,並使用以下代碼顯示圖像(jpg)3秒,當我的應用程序打開。問題是,圖像被拉伸到整個屏幕,並且其他時間似乎根據屏幕尺寸被壓縮。我怎麼解決這個問題?我需要圖像以適合每個屏幕尺寸?由於Spash屏幕拉伸不是很好,在不同的Android屏幕設備

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/background" 
android:scaleType="fitXY"> 


<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="10dp" 
    android:textSize="30dp" 
    android:textColor="#454545" 
    android:gravity="center_horizontal" 
    android:layout_alignParentTop="true" 
    android:text="xxxx"/> 

我使用Android:scaleType = 「fitXY」,但似乎沒有工作。圖像尺寸是820x615

回答

0

這不工作,因爲每個android有不同的長寬比。唯一的兩個選項是使用fitxy拉伸圖像,或者您可以在scaleType上使用CENTER_CROP,並使其展開並切掉不適合的東西。

+0

謝謝。我終於使用了android:scaleType =「fitXY」,圖像在不同的設備上看起來更好。 – Thanos