Java 如何减少启动屏幕的时间
这需要7-10秒,我想知道有没有办法缩短时间。在我安装启动屏幕之前,主页在2-3秒内加载。我已经安装了Java 如何减少启动屏幕的时间,java,android,react-native,react-native-android,splash-screen,Java,Android,React Native,React Native Android,Splash Screen,这需要7-10秒,我想知道有没有办法缩短时间。在我安装启动屏幕之前,主页在2-3秒内加载。我已经安装了react native闪屏软件包,并使用@bam.tech/react native make自动配置了android文件 如果你想知道的话,从来没有在真正的设备上试过 MainActivity.java package com.myApp; import android.os.Bundle; import org.devio.rn.splashscreen.SplashScreen; im
react native闪屏
软件包,并使用@bam.tech/react native make
自动配置了android文件
如果你想知道的话,从来没有在真正的设备上试过
MainActivity.java
package com.myApp;
import android.os.Bundle;
import org.devio.rn.splashscreen.SplashScreen;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this, R.style.SplashScreenTheme);
super.onCreate(savedInstanceState);
}
@Override
protected String getMainComponentName() {
return "myApp";
}
}
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myApp">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splashprimary" />
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash_image" />
</item>
</layer-list>
styles.xml
<resources>
<style name="SplashScreenTheme" parent="SplashScreen_SplashTheme">
<item name="colorPrimaryDark">@color/splashprimary</item>
<item name="android:statusBarColor">@color/app_bg</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:textColor">#000000</item>
<!-- Add the following line to set the default status bar color for all the app. -->
<item name="android:statusBarColor">@color/app_bg</item>
<!-- Add the following line to set the default status bar text color for all the app
to be a light color (false) or a dark color (true) -->
<item name="android:windowLightStatusBar">false</item>
<!-- Add the following line to set the default background color for all the app. -->
<item name="android:windowBackground">@color/app_bg</item>
</style>
</resources>
@彩色/彩色初级
@颜色/应用背景
#000000
@颜色/应用背景
假的
@颜色/应用背景
尝试将其添加到Style.xml中
<item name="android:windowDisablePreview">true</item>
true
这将删除“开始”中出现的白色屏幕。我通常使用活动和计时器创建自己的启动屏幕。我从来不知道这件事。谢谢你的信息@react native make的SandrinJoy使它非常容易实现,您只需要一个.png的启动屏幕。另外,不要忘记在根文件中隐藏启动屏幕
SplashScreen.hide()
,这样就不会有动画了?呵呵。那是一个单调的启动屏幕是的,它只显示.png文件作为启动屏幕。专业人士实际使用的是哪种方法?我试过了,但至少需要7秒钟才能加载