我是大家.使用启动画面时,我目前的焦点有问题.我正在使用VS2008,带有.NET framework 2.0.此外,我已将我的项目与VisualBasic.dll链接,因为我使用ApplicationServices来管理我的单实例应用程序和启动画面.
这是一个简化了我尝试调试的代码片段.
namespace MyProject
{
public class Bootstrap
{
/// <summary>
/// Main entry point of the application. It creates a default
/// Configuration bean and then creates and show the MDI
/// Container.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// Creates a new App that manages the Single Instance background work
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
App myApp = new App();
myApp.Run(args);
}
}
public class App : WindowsFormsApplicationBase
{
public App()
: base()
{
// Make this …Run Code Online (Sandbox Code Playgroud) 如何正确显示防溅板?我正在使用CLi本地版本,我听说它是兼容的.我添加了插件:phonegap插件添加org.apache.cordova.splashscreen这是我的配置文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.Snap.What" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>WhatSnap</name>
<description>
Hello World sample application that responds to the deviceready event.
</description>
<author email="support@phonegap.com" href="http://phonegap.com">
PhoneGap Team
</author>
<feature name="http://api.phonegap.com/1.0/device" />
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference …Run Code Online (Sandbox Code Playgroud) 能否以编程方式更改原生 android 启动画面颜色,以便可以将其设置为适合为 Flutter 应用程序选择的主题?
有点像当系统主题设置为深色时 WhatsApp 启动画面在深色主题中的加载方式。
深色和浅色 WhatsApp 启动画面:

我猜这使用两个主题作为启动画面,它们链接到系统主题,但我不太了解如何以及是否可能。
所以问题是:是否可以在运行 flutter 应用程序时更改启动画面的颜色/主题,以便在应用程序的下一次启动时,原生 android 启动画面以与 Flutter 应用程序相同的主题加载?
(对不起,如果我重复了很多,但我想尽可能好地描述我的要求)
这与闪屏图像响应能力有关,根据我的研究,这只是因为Capacitor Docs - Splash Screen 中缺少文档。
问题是在实现电容的闪屏插件时开始的。通常,当您创建整个项目时,此实现是从头开始的。然而,它没有/没有对具有设备工作良好拉伸纵横比(例如谷歌像素2 XL)或具有设备脂肪纵横比(例如iPad的专业版)。甚至在某些情况下,启动画面图像会四处移动或缩小/扩展(加载时)。
换句话说,本机实现导致启动画面图像就像下图一样。如果设备被拉伸或变胖,则不会保留图像纵横比。
我有一个Default react本机项目,我安装了From This Turorial,我刚刚使用本教程将Splash Screen添加到我的项目中,但我得到了第一个:
解决此问题的最佳和最常用的方法是什么? 我需要只有1个标准预加载启动屏幕和该应用程序启动之后,我阅读更多文章,但我不能通过本机反应修复.
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" />
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Run Code Online (Sandbox Code Playgroud)
我有一个包含两个活动的应用程序,一个启动屏幕活动和另一个包含应用程序主导航图的应用程序。
我想利用 Android 导航组件附带的新深度链接处理。然而,按照谷歌教程,点击链接时会跳过启动画面,直接进入应用程序的导航图。
有什么方法可以使用这些新功能,同时在导航到应用程序的正确部分之前仍然强制首先显示启动画面?
我想用最少的动画(如旋转图像)创建一个启动屏幕。从此处找到的文档中,我认为可以使用“创建自定义 SplashScreen”部分中提到的方法来这样做。但我不知道从哪里开始。我首先使用创建了一个颤振 java 项目
flutter create -a java custom_splash
Run Code Online (Sandbox Code Playgroud)
然后我尝试复制粘贴文件内文档链接中给出的代码MainActivity.java并运行该应用程序,但该应用程序根本无法构建。我也尝试在内部使用旋转可绘制对象,launch_background.xml尽管它确实将图像旋转到特定角度,但它是静态的而不是动画的。
注意:我没有构建任何原生 android 应用程序,java 对我来说也是新的
编辑 1:
我想我必须将它显示为视图而不是可绘制对象。所以我尝试了这个。创建了一个名为SplashScreenWithTransition.javanext的文件MainActivity.java
package com.example.native_splash;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.native_splash.mySplashView;
import io.flutter.embedding.android.SplashScreen;
public class SplashScreenWithTransition implements SplashScreen {
@Override
@Nullable
public View createSplashView(
@NonNull Context context,
@Nullable Bundle savedInstanceState
) {
return new mySplashView(context);
}
@Override
public void transitionToFlutter(@NonNull Runnable onTransitionComplete) {
onTransitionComplete.run();
}
}
Run Code Online (Sandbox Code Playgroud)
和另一个名为 mySplashView.java …
当应用程序加载时,有一个白色背景,然后在显示启动画面之前闪烁。我已经从 app.json 文件中删除了启动画面,因为我正在手动加载和隐藏启动画面。(将启动画面留在 app.json 文件中会导致显示启动画面,然后出现白色闪烁,然后再次显示启动画面)
应用程序.js
import React from 'react';
import { StyleSheet, View, Image } from 'react-native'
import { MyAuthStack, MyMainDrawer } from './Screens/Navigators'
import firebase from './firebase'
import { AppLoading, SplashScreen } from 'expo';
import { Asset } from 'expo-asset';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
authState: false,
imgUrl: '',
isSplashReady: false,
isAppReady: false,
}
}
_cacheSplashResourcesAsync = async () => {
const gif = require('./assets/splash.png');
return Asset.fromModule(gif).downloadAsync();
}
_cacheResourcesAsync = …Run Code Online (Sandbox Code Playgroud) 如果您使用@capacitor/splash-screen API 在带有 Capacitor 3 的 Ionic Android 应用程序中显示启动画面,您可能会遇到以下问题:
在几分之一秒内,飞溅图像将扭曲显示,直到以正确的纵横比显示。这意味着它也会在屏幕上“跳跃”一点,如果您在设备处于横向时启动应用程序,或者您的设备已拉伸或显示宽高比,这将特别明显。
发生这种情况是因为AppTheme.NoActionBarLaunch在应用程序启动时使用它MainActivity被设置为将启动图像作为背景图像,但“真实”启动图像在几毫秒后在SplasScreen.buildViews()插件的方法中被初始化。
要修复它,您可以在您的styles.xml文件中更改以下内容/android/app/src/main/values:
老的:
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">@drawable/splash</item>
</style>
Run Code Online (Sandbox Code Playgroud)
新(无背景):
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">@null</item>
</style>
Run Code Online (Sandbox Code Playgroud)
或者设置启动画面的背景颜色:
<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<item name="android:background">#ffffff</item>
</style>
Run Code Online (Sandbox Code Playgroud)
这将防止在将实际 ImageView 添加到视图层次结构之前将启动图像显示为背景图像。ImageView 将具有androidScaleType插件配置中定义的正确 scaleType 。
使用以下版本进行测试:
使用以下配置:
const config: CapacitorConfig = {
// ...
plugins: {
SplashScreen: {
launchShowDuration: 3000,
launchAutoHide: …Run Code Online (Sandbox Code Playgroud) 我使 Splash Screen API 正常工作,但在 Android 8 和 9 上崩溃并重新启动 Android 系统。
这是代码和日志:
清单.xml
<application
android:name=".App"
android:allowBackup="false"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme">
<activity
android:name=".ui.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Splash"
android:clearTaskOnLaunch="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.MainActivity"/>
</application>
Run Code Online (Sandbox Code Playgroud)
样式.xml
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryVariant">@color/colorPrimaryVariant</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/colorSecondary</item>
<item name="colorOnSecondary">@color/white</item>
<item name="colorSurface">@color/white</item>
<item name="colorError">@color/colorError</item>
<item name="android:statusBarColor">@color/colorBackground</item>
<item name="android:navigationBarColor">@color/colorBackground</item>
<item name="android:windowLightStatusBar" tools:ignore="NewApi">true</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">true</item>
<item name="android:windowBackground">@color/colorBackground</item>
</style>
<style name="AppTheme.Splash" …Run Code Online (Sandbox Code Playgroud) splash-screen ×10
android ×6
capacitor ×2
flutter ×2
react-native ×2
angular ×1
animation ×1
c# ×1
components ×1
cordova ×1
cordova-3 ×1
dart ×1
deep-linking ×1
expo ×1
flicker ×1
focus ×1
navigation ×1
themes ×1