Problems with the screen saver?

I use the following code to display a splash screen, but it shows the margin below. Can someone please tell me what mistake I am making here?

My image resolution is 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> 

manifest:

 <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

+4
source share
3 answers

try adding android:scaleType="fitXY" to your XML (in your ImageView)

+7
source

If you need full screen, try the following. This should also scale the image to fit the screen:

 <?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> 
+2
source

Just a small addition to the answers already provided. If the answers provided do not work for you right away, try deleting them (if they exist)

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

This is what I did before William answered me.

0
source

All Articles