简体   繁体   中英

React Native dynamic splash screen?

I would like to add a dynamic splash screen to my app that takes an image from an external webserver.

For Android I would usually use a mipmap and create a layout like this:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

  <item
    android:drawable="@color/gray"/>

  <item>
    <bitmap
      android:gravity="center"
      android:src="@mipmap/splash_screen"/>
  </item>

</layer-list>

The question is if I can download an image and store it to the mimap folders with ReactNative so that Android will take it on the next start?

Of course I'm open to alternative ideas.

Hope this would help you....

window.statusBarColor = R.color.VoiceRecognizerDark


//step2 : changing window layout dimension to place the splash screen above the navigation bar
        val displayMetrics = DisplayMetrics()
        windowManager.defaultDisplay.getMetrics(displayMetrics)
        val height = displayMetrics.heightPixels
        val width = displayMetrics.widthPixels

//        val navigationBarHeight = getNavigationBarHeight()
        window.setLayout(width, height)
        window.setGravity(Gravity.TOP)

//       step3 : here comes the dynamic splash sreen image (png)
        window.setBackgroundDrawableResource(R.drawable.splash_background_min)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM