簡體   English   中英

React Native 動態啟動畫面?

[英]React Native dynamic splash screen?

我想向我的應用程序添加一個動態啟動畫面,它從外部網絡服務器獲取圖像。

對於 Android,我通常會使用 mipmap 並創建這樣的布局:

<?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>

問題是我是否可以使用 ReactNative 下載圖像並將其存儲到 mimap 文件夾,以便 Android 在下次啟動時使用它?

當然,我對其他想法持開放態度。

希望這會幫助你......

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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM