简体   繁体   English

PNG图像未缩放到全屏大小

[英]PNG image not scaling to full screen size

I have a splash screen on my android app, which is populated by a png image. 我的Android应用程序上有一个启动画面,它由png图像填充。 However the png image is not populating the full screen, there are spaces showing on the sides. 然而,png图像没有填充整个屏幕,侧面显示空格。

I am viewing this on and AVD. 我正在观看和AVD。

Here is what I see: 这是我看到的: 我的SPLASHSCREEN的视图

Here is my XML code: 这是我的XML代码:

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

 <ImageView
 android:src="@drawable/splash"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"></ImageView>  

</LinearLayout>

Here is an extract of my Android Manifest code: 这是我的Android Manifest代码的摘录:

<uses-sdk
    android:minSdkVersion="5"
    android:targetSdkVersion="17" />

<supports-screens 
android:resizeable="true"
android:smallScreens="true" 
android:normalScreens="true" 
android:largeScreens="true"
android:anyDensity="true" />


<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" >
            <activity
        android:name="com.shaadcorp.wazaifapp.MainMenu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="ButtonMenu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.shaadcorp.wazaifapp.CLEARSCREEN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>   
    <activity
        android:name="wazeefa"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.shaadcorp.wazaifapp.WAZEEFA" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="durood"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.shaadcorp.wazaifapp.DUROOD" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

</application>

</manifest>

Please can any one help? 请任何人帮忙吗? I have tried to increse the dimesions of the png itself but this makes no difference. 我试图增加png本身的角度,但这没有任何区别。

You need to add the android:scaleType attribute to the ImageView . 您需要将android:scaleType属性添加到ImageView Probably centerCrop is what you want. 可能是centerCrop就是你想要的。

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scaleType="centerCrop"
    android:src="@drawable/splash" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM