0

I'm using a xml drawable:

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/splashscreen"
    android:tileMode="disabled" android:gravity="top" >
</bitmap>

this is my imageView in the layout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/splash_image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY"
         />

</RelativeLayout>

but no matter what I do, it doesn't fit the screen, and only appears in the centre as a small image. Where am I going wrong?

Hick
  • 35,524
  • 46
  • 151
  • 243

2 Answers2

1

Maybe not the best solution since different devices has different resolutions, but "wrap_content" will display the image in its original resolution.

 <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <ImageView
            android:id="@+id/splash_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/splashscreen"
        />
    </RelativeLayout>
m.Ling
  • 296
  • 1
  • 6
0

Try using fill_parent Each device have different screen size so you need to make different splash image for each size and resolution i guess the problem is you are using image of small size(height width) and the display is big so you need to scale image to fit to display size, this might pixelate the image

Vikas Rathod
  • 374
  • 2
  • 14
  • You should use `MATCH_PARENT`, `FILL_PARENT` is deprecated. From [ViewGroup.LayoutParams](http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html) `FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)` – quinnjn Jan 14 '14 at 15:14
  • The word "deprecated" isn't mentioned in the link above. Read twice! It only says that it has been renamed (renamed != deprecated). – Phantômaxx Jan 14 '14 at 15:26
  • sorry my apologies, i guessed MATCH_PARENT was renamed. but i think other part is right, this is what i did for my solution. making different images for different screen size. – Vikas Rathod Jan 14 '14 at 17:18