2011-06-08 136 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的答案为我工作之前所做的。