skip to Main Content

I’m using React Native to create an Android app, using Android Studio and an emulator. I’m working on it’s splashscreen first but I’m having trouble putting color behind the logo of the app. The picture being used is 193 x 192 with 96 DPI.

File layout

launch_screen.xml file

colors.xml file

styles.xml file

splash screen image with gray on top and bottom within emulator

I’ve tried setting

<item name="android:windowBackground">@color/blue</item>

in styles.xml but that changes the wrong thing. Any ideas?

2

Answers


  1. This is how it works in Expo in app.json

    https://docs.expo.dev/versions/latest/config/app/#backgroundcolor

    {
      "expo": {
        ...
        "splash": {
          "image": "./app/splash.png",
          "resizeMode": "cover",
          "backgroundColor": "#ffffff"
        },
       }
    }
    Login or Signup to reply.
  2. In your launch_screen.xml file’s Relative Layout, you need to add background prop like android:background="@color/blue".

    So, it will look like this,

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@color/blue">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search