我添加splash屏幕,它在iOS中工作正常,但在Android设备中需要更多时间。这是我的config.xml preference
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
我的component.ts文件是
import { SplashScreen } from '@ionic-native/splash-screen';
constructor(public platform: Platform,
public Alert : AlertController,
public statusBar: StatusBar,
public splashScreen: SplashScreen,
public keyboard : Keyboard
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.keyboard.hideKeyboardAccessoryBar(false);
this.keyboard.disableScroll(true);
});
}
在以下任何一个CLI命令中添加--prod
标志
ionic emulate android --prod
ionic build android --prod
ionic run android --prod