启动画面边距问题?

5
我正在使用以下代码来显示启动画面,但是它在底部显示了一个边距。请问有谁可以指导我这里犯了什么错误吗?
我的图片分辨率为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


当语言为英语时,它可以完美地工作并在全屏上显示,但当我将语言更改为其他语言时,上面的图像显示为闪屏。即使在两个文件夹中,图像也是相同的drawable-sr-rRS-hdpi和drawable-en-rUS-port-hdpi图像。 - UMAR-MOBITSOLUTIONS
3个回答

8
尝试在你的 XML(ImageView 中)添加 android:scaleType="fitXY"。

4
如果您想要全屏显示,请尝试以下方法。这也可以缩放图像以适应屏幕:
<?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

对于已经给出的答案,只是做了一个小小的补充。如果提供的答案不能立即解决您的问题,请尝试删除这些内容(如果存在)。

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

那是在威廉的答案对我有用之前我所做的。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接