TinkerTek TinkerTek - 3 months ago 49
Android Question

Android Studio Fullscreen Background Image with android:background

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?

Answer

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.

Comments