Reputation: 39
I have been trying to make an Android app with a full screen background image, but just can't get the picture to fill the whole screen.
Here's what I have so far:
activity_main_screen.xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainScreen"
android:background="@mipmap/background">
</RelativeLayout>
Any ideas?
Upvotes: 0
Views: 10160
Reputation: 13
Move background.png to the drawable folder. Then change your code to
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainScreen"
android:background="@drawable/background"
>
Upvotes: 0
Reputation: 5149
Any images other than icons should not be placed in the mipmap
folder.
According to the official Android blog:
It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density. - (source)
You will need to move background.png
to the relevant drawable
folder.
Upvotes: 6
Reputation: 3249
Try like the following:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainScreen"
android:background="@mipmap/background"
>
Upvotes: 0