2011-06-08 139 views
4

我正在使用下面的代碼來顯示啓動畫面,但它顯示在底部的邊距。任何人都可以引導我在這裏犯什麼錯誤?初始屏幕邊緣問題?

我的圖像分辨率爲480 X 800

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" 
> 
<ImageView android:src="@drawable/splash" 
android:layout_width="wrap_content" android:id="@+id/imageView1" android:layout_height="wrap_content"></ImageView> 
</RelativeLayout> 

清單:

<application android:name="MyApplication" android:icon="@drawable/icon" android:label="@string/app_name"> 
     <activity android:name=".SplashScreen" android:configChanges="locale" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 

enter image description here

+0

雖然語言是英語,它完美的作品完美,並顯示在全屏幕上,但當我改變語言以外的其他比它上面的圖像顯示爲飛濺。即使在這兩個文件夾圖像是相同的drawable-sr-rRS-hdpi和drawable-en-rUS-port-hdpi圖片 – UMAR 2011-06-08 13:39:09

回答

7

嘗試添加android:scaleType="fitXY"到您的XML(在你的ImageView)

+0

感謝您的回覆。是的,這是我正在尋找的。 – UMAR 2011-06-08 13:41:18

+0

歡迎你,我們在這裏幫助: – Houcine 2011-06-08 13:43:12

2

如果你想要它全屏幕,請嘗試以下。這也應該縮放圖像以適應屏幕:

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

     <ImageView 
      android:src="@drawable/splash" 
      android:layout_width="fill_parent" 
      android:id="@+id/imageView1" 
      android:layout_height="fill_parent" 
      android:scaleType="fitXY"/> 
</RelativeLayout> 
+0

感謝您的回覆。是的,這是我正在尋找的。 – UMAR 2011-06-08 13:41:12

0

只是一點點除了答案已經given.If提供的答案不適合你工作的時候,嘗試刪除這些(如果存在)

android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 

這就是我在William的答案爲我工作之前所做的。