2015-04-23 135 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