expo-splash-screen2 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -1
- package/README.zh.md +137 -1
- package/expo-splash-web/build-splash-web.js +483 -277
- package/package.json +3 -2
- package/plugin/build/index.js +61 -9
- package/plugin/build/templates/android.js +9 -7
- package/scripts/postinstall.js +97 -6
- package/scripts/setup.js +100 -0
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
- [WebView Mode](#webview-mode)
|
|
16
16
|
- [ResponsiveImage Mode](#responsiveimage-mode)
|
|
17
17
|
- [Normal Mode](#normal-mode)
|
|
18
|
+
- [Blend Mode](#blend-mode)
|
|
18
19
|
- [Dark Mode Support](#dark-mode-support)
|
|
19
20
|
- [📱 Platform-Specific Details](#-platform-specific-details)
|
|
20
21
|
- [iOS Configuration](#-ios-configuration)
|
|
@@ -143,7 +144,7 @@ Your app now has a custom WebView-based splash screen. For more advanced configu
|
|
|
143
144
|
|
|
144
145
|
### Display Modes
|
|
145
146
|
|
|
146
|
-
`expo-splash-screen2` provides
|
|
147
|
+
`expo-splash-screen2` provides four splash screen modes to fit different use cases:
|
|
147
148
|
|
|
148
149
|
#### `webview` Mode
|
|
149
150
|
|
|
@@ -171,6 +172,16 @@ Display a centered image with fixed width (default 100px), maintaining aspect ra
|
|
|
171
172
|
- **Supports dark mode** with separate image and background color
|
|
172
173
|
- Best for logo-centric splash screens
|
|
173
174
|
|
|
175
|
+
#### `blend` Mode
|
|
176
|
+
|
|
177
|
+
Combine a `.9.png` background image with WebView HTML content for enhanced splash screen experience.
|
|
178
|
+
|
|
179
|
+
- Uses `.9.png` image as system splash screen background
|
|
180
|
+
- WebView container uses transparent background (recommended) for seamless transition
|
|
181
|
+
- Full HTML/JavaScript/CSS support in WebView overlay
|
|
182
|
+
- Perfect for achieving smooth transition from system splash to custom animated splash
|
|
183
|
+
- Best for apps requiring both native performance and rich animations
|
|
184
|
+
|
|
174
185
|
### Dark Mode Support (Normal Mode)
|
|
175
186
|
|
|
176
187
|
`expo-splash-screen2` supports per-appearance splash screens that respond to system appearance changes on iOS 13+ and Android 10+.
|
|
@@ -397,6 +408,12 @@ Display a centered image with fixed width, maintaining aspect ratio. Supports da
|
|
|
397
408
|
</tbody>
|
|
398
409
|
</table>
|
|
399
410
|
|
|
411
|
+
#### `blend` Mode
|
|
412
|
+
|
|
413
|
+
Combine a `.9.png` background image with WebView HTML content for enhanced splash screen experience. The system splash screen uses the `.9.png` image as background, and the WebView container uses transparent background (recommended) for seamless transition.
|
|
414
|
+
|
|
415
|
+
**Note**: Blend mode combines the visual appearance of `responsiveImage` mode (`.9.png` background) with the functionality of `webview` mode (HTML content overlay). This creates a smooth transition from the system splash screen to the custom animated splash screen.
|
|
416
|
+
|
|
400
417
|
## 💻 Installation
|
|
401
418
|
|
|
402
419
|
### Installation in managed Expo projects
|
|
@@ -508,6 +525,15 @@ Display HTML content with full JavaScript/CSS support:
|
|
|
508
525
|
}
|
|
509
526
|
```
|
|
510
527
|
|
|
528
|
+
> **Note**: For `webview` and `blend` modes, you must install `react-native-web` to build web files:
|
|
529
|
+
> ```bash
|
|
530
|
+
> npm install react-native-web
|
|
531
|
+
> # or
|
|
532
|
+
> pnpm add react-native-web
|
|
533
|
+
> # or
|
|
534
|
+
> yarn add react-native-web
|
|
535
|
+
> ```
|
|
536
|
+
|
|
511
537
|
#### WebView Mode Options
|
|
512
538
|
|
|
513
539
|
| Option | Type | Required | Description |
|
|
@@ -577,6 +603,55 @@ Display a centered image with fixed width:
|
|
|
577
603
|
| `imageWidth` | `number` | No | Image width in dp/pt (default: `100`) |
|
|
578
604
|
| `dark` | `object` | No | Dark mode configuration |
|
|
579
605
|
|
|
606
|
+
### Blend Mode
|
|
607
|
+
|
|
608
|
+
Combine a `.9.png` background image with WebView HTML content for enhanced splash screen experience:
|
|
609
|
+
|
|
610
|
+
```json
|
|
611
|
+
{
|
|
612
|
+
"expo": {
|
|
613
|
+
"plugins": [
|
|
614
|
+
[
|
|
615
|
+
"expo-splash-screen2",
|
|
616
|
+
{
|
|
617
|
+
"mode": "blend",
|
|
618
|
+
"image": "./assets/splash-background.9.png"
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
> **Note**: For `webview` and `blend` modes, you must install `react-native-web` to build web files:
|
|
627
|
+
> ```bash
|
|
628
|
+
> npm install react-native-web
|
|
629
|
+
> # or
|
|
630
|
+
> pnpm add react-native-web
|
|
631
|
+
> # or
|
|
632
|
+
> yarn add react-native-web
|
|
633
|
+
> ```
|
|
634
|
+
|
|
635
|
+
#### Blend Mode Options
|
|
636
|
+
|
|
637
|
+
| Option | Type | Required | Description |
|
|
638
|
+
|--------|------|----------|-------------|
|
|
639
|
+
| `mode` | `"blend"` | Yes | Enable blend mode (`.9.png` background + WebView) |
|
|
640
|
+
| `image` | `string` | Yes | Path to background image (supports `.9.png`) |
|
|
641
|
+
| `localHtmlPath` | `string` | No | Path to custom HTML file |
|
|
642
|
+
|
|
643
|
+
**How Blend Mode Works:**
|
|
644
|
+
|
|
645
|
+
- **System Splash Screen**: Uses `.9.png` image as background (Android 12+ system splash screen)
|
|
646
|
+
- **WebView Container**: Uses transparent background (recommended) to show the system splash screen background for seamless visual continuity
|
|
647
|
+
- **HTML Overlay**: Displays custom HTML content in WebView on top of the background
|
|
648
|
+
- **Transition**: Smooth transition from system splash to WebView splash without visual gaps
|
|
649
|
+
|
|
650
|
+
This mode is ideal when you want:
|
|
651
|
+
- Native performance of system splash screen
|
|
652
|
+
- Rich animations and interactivity from HTML/WebView
|
|
653
|
+
- Seamless visual transition between system and custom splash screens
|
|
654
|
+
|
|
580
655
|
### Dark Mode Support
|
|
581
656
|
|
|
582
657
|
Enable dark mode support in `normal` mode by adding the `dark` configuration:
|
|
@@ -694,6 +769,28 @@ For Normal mode, the plugin:
|
|
|
694
769
|
- Add width constraint (default 100pt) to Image View
|
|
695
770
|
4. Modify `AppDelegate.swift` to add image container view with width constraints
|
|
696
771
|
|
|
772
|
+
#### Blend Mode
|
|
773
|
+
|
|
774
|
+
For Blend mode, the plugin:
|
|
775
|
+
|
|
776
|
+
1. **Copies background image**: Places `.9.png` image file as `splash_background_image.{ext}` in `ios/{projectName}/` directory
|
|
777
|
+
2. **Copies HTML files**: Places HTML files from `expo-splash-web/dist` or `localHtmlPath` to `ios/{projectName}/` directory
|
|
778
|
+
3. **Modifies `SplashScreen.storyboard`**: Sets full-screen background image with `scaleAspectFill` content mode (same as ResponsiveImage mode)
|
|
779
|
+
4. **Modifies `AppDelegate.swift`**: Adds WebView overlay code with transparent background (recommended)
|
|
780
|
+
|
|
781
|
+
**Manual steps** (if needed):
|
|
782
|
+
|
|
783
|
+
1. Copy `.9.png` background image to `ios/{projectName}/splash_background_image.{ext}`
|
|
784
|
+
2. Copy HTML file to `ios/{projectName}/index.html`
|
|
785
|
+
3. Modify `SplashScreen.storyboard`:
|
|
786
|
+
- Set Image View to use `splash_background_image` image
|
|
787
|
+
- Set Content Mode to `Aspect Fill` for full-screen coverage
|
|
788
|
+
- Set background color (fallback)
|
|
789
|
+
4. Modify `AppDelegate.swift`:
|
|
790
|
+
- Add WebView container code (see plugin source for template)
|
|
791
|
+
- Set WebView container background to transparent (recommended) for seamless transition
|
|
792
|
+
5. Add image and HTML files to Xcode project file references
|
|
793
|
+
|
|
697
794
|
### 🤖 Android Configuration
|
|
698
795
|
|
|
699
796
|
The plugin automatically:
|
|
@@ -815,6 +912,45 @@ For Normal mode, the plugin:
|
|
|
815
912
|
```
|
|
816
913
|
7. Modify `MainActivity.kt` to add image container view with fixed width (default 100dp)
|
|
817
914
|
|
|
915
|
+
#### Blend Mode
|
|
916
|
+
|
|
917
|
+
For Blend mode, the plugin:
|
|
918
|
+
|
|
919
|
+
1. **Copies background image**: Places `.9.png` image as `splash_background_image.{ext}` in `android/app/src/main/res/drawable/`
|
|
920
|
+
2. **Copies HTML file**: Places HTML file from `expo-splash-web/dist/index.html` or `localHtmlPath` to `android/app/src/main/assets/index.html`
|
|
921
|
+
3. **Creates CustomSplashActivity**: Generates `SplashScreen2Activity.kt` with transparent WebView container background (recommended)
|
|
922
|
+
4. **Modifies AndroidManifest.xml**: Adds `SplashScreen2Activity` as launcher activity, sets `MainActivity` theme to `Theme.App.SplashScreen`
|
|
923
|
+
5. **Modifies MainActivity.kt**: Adds WebView container code with transparent background (recommended)
|
|
924
|
+
6. **Modifies styles.xml**: Updates `Theme.App.SplashScreen` to use `.9.png` background image
|
|
925
|
+
7. **Creates colors.xml**: Creates `splashscreen_background` color resource
|
|
926
|
+
8. **Updates build.gradle**: Adds `androidx.core:core-splashscreen` dependency
|
|
927
|
+
|
|
928
|
+
**Manual steps** (if needed):
|
|
929
|
+
|
|
930
|
+
1. Copy `.9.png` background image to `android/app/src/main/res/drawable/splash_background_image.{ext}`
|
|
931
|
+
2. Copy HTML file to `android/app/src/main/assets/index.html`
|
|
932
|
+
3. Create `SplashScreen2Activity.kt` in `android/app/src/main/java/{packageName}/`:
|
|
933
|
+
- Set WebView container background to transparent (recommended, see plugin templates)
|
|
934
|
+
4. Modify `AndroidManifest.xml`:
|
|
935
|
+
- Add `SplashScreen2Activity` as launcher activity
|
|
936
|
+
- Set `MainActivity` theme to `Theme.App.SplashScreen` (same as splash screen theme)
|
|
937
|
+
5. Modify `MainActivity.kt`:
|
|
938
|
+
- Add WebView container code
|
|
939
|
+
- Set WebView container background to transparent (recommended) for seamless transition
|
|
940
|
+
6. Update `res/values/styles.xml`:
|
|
941
|
+
```xml
|
|
942
|
+
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
|
|
943
|
+
<item name="android:windowBackground">@drawable/splash_background_image</item>
|
|
944
|
+
</style>
|
|
945
|
+
```
|
|
946
|
+
7. Create `res/values/colors.xml`:
|
|
947
|
+
```xml
|
|
948
|
+
<resources>
|
|
949
|
+
<color name="splashscreen_background">#FFFFFF</color>
|
|
950
|
+
</resources>
|
|
951
|
+
```
|
|
952
|
+
8. Add `androidx.core:core-splashscreen:1.0.1` dependency to `build.gradle`
|
|
953
|
+
|
|
818
954
|
### Manual Regeneration
|
|
819
955
|
|
|
820
956
|
If you need to regenerate native projects with the latest plugin changes:
|
package/README.zh.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
- [WebView 模式](#webview-模式)
|
|
16
16
|
- [ResponsiveImage 模式](#responsiveimage-模式)
|
|
17
17
|
- [Normal 模式](#normal-模式)
|
|
18
|
+
- [Blend 模式](#blend-模式)
|
|
18
19
|
- [深色模式支持](#深色模式支持)
|
|
19
20
|
- [📱 平台特定详情](#-平台特定详情)
|
|
20
21
|
- [iOS 配置](#-ios-配置)
|
|
@@ -143,7 +144,7 @@ npx expo prebuild
|
|
|
143
144
|
|
|
144
145
|
### 显示模式
|
|
145
146
|
|
|
146
|
-
`expo-splash-screen2`
|
|
147
|
+
`expo-splash-screen2` 提供四种启动屏幕模式以适应不同的使用场景:
|
|
147
148
|
|
|
148
149
|
#### `webview` 模式
|
|
149
150
|
|
|
@@ -171,6 +172,16 @@ npx expo prebuild
|
|
|
171
172
|
- **支持深色模式**,具有独立的图片和背景颜色
|
|
172
173
|
- 最适合以 Logo 为中心的启动屏幕
|
|
173
174
|
|
|
175
|
+
#### `blend` 模式
|
|
176
|
+
|
|
177
|
+
结合 `.9.png` 背景图片和 WebView HTML 内容,增强开屏体验。
|
|
178
|
+
|
|
179
|
+
- 使用 `.9.png` 图片作为系统启动屏幕背景
|
|
180
|
+
- WebView 容器使用透明背景(推荐),实现无缝过渡
|
|
181
|
+
- WebView 覆盖层支持完整的 HTML/JavaScript/CSS
|
|
182
|
+
- 完美实现从系统启动屏幕到自定义动画启动屏幕的平滑过渡
|
|
183
|
+
- 最适合需要原生性能和丰富动画的应用
|
|
184
|
+
|
|
174
185
|
### 深色模式支持(Normal 模式)
|
|
175
186
|
|
|
176
187
|
`expo-splash-screen2` 支持根据系统外观变化而响应的启动屏幕,适用于 iOS 13+ 和 Android 10+。
|
|
@@ -397,6 +408,12 @@ export default function RootLayout() {
|
|
|
397
408
|
</tbody>
|
|
398
409
|
</table>
|
|
399
410
|
|
|
411
|
+
#### `blend` 模式
|
|
412
|
+
|
|
413
|
+
结合 `.9.png` 背景图片和 WebView HTML 内容,增强开屏体验。系统启动屏幕使用 `.9.png` 图片作为背景,WebView 容器使用透明背景(推荐),实现无缝过渡。
|
|
414
|
+
|
|
415
|
+
**注意**:Blend 模式结合了 `responsiveImage` 模式的视觉效果(`.9.png` 背景)和 `webview` 模式的功能(HTML 内容覆盖层)。这实现了从系统启动屏幕到自定义动画启动屏幕的平滑过渡。
|
|
416
|
+
|
|
400
417
|
## 💻 安装
|
|
401
418
|
|
|
402
419
|
### 在托管 Expo 项目中安装
|
|
@@ -508,6 +525,15 @@ npx expo prebuild
|
|
|
508
525
|
}
|
|
509
526
|
```
|
|
510
527
|
|
|
528
|
+
> **注意**:对于 `webview` 和 `blend` 模式,必须安装 `react-native-web` 来打包 web 文件:
|
|
529
|
+
> ```bash
|
|
530
|
+
> npm install react-native-web
|
|
531
|
+
> # 或
|
|
532
|
+
> pnpm add react-native-web
|
|
533
|
+
> # 或
|
|
534
|
+
> yarn add react-native-web
|
|
535
|
+
> ```
|
|
536
|
+
|
|
511
537
|
#### WebView 模式选项
|
|
512
538
|
|
|
513
539
|
| 选项 | 类型 | 必需 | 描述 |
|
|
@@ -577,6 +603,55 @@ npx expo prebuild
|
|
|
577
603
|
| `imageWidth` | `number` | 否 | 图片宽度(单位:dp/pt,默认:`100`) |
|
|
578
604
|
| `dark` | `object` | 否 | 深色模式配置 |
|
|
579
605
|
|
|
606
|
+
### Blend 模式
|
|
607
|
+
|
|
608
|
+
结合 `.9.png` 背景图片和 WebView HTML 内容,增强开屏体验:
|
|
609
|
+
|
|
610
|
+
```json
|
|
611
|
+
{
|
|
612
|
+
"expo": {
|
|
613
|
+
"plugins": [
|
|
614
|
+
[
|
|
615
|
+
"expo-splash-screen2",
|
|
616
|
+
{
|
|
617
|
+
"mode": "blend",
|
|
618
|
+
"image": "./assets/splash-background.9.png"
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
> **注意**:对于 `webview` 和 `blend` 模式,必须安装 `react-native-web` 来打包 web 文件:
|
|
627
|
+
> ```bash
|
|
628
|
+
> npm install react-native-web
|
|
629
|
+
> # 或
|
|
630
|
+
> pnpm add react-native-web
|
|
631
|
+
> # 或
|
|
632
|
+
> yarn add react-native-web
|
|
633
|
+
> ```
|
|
634
|
+
|
|
635
|
+
#### Blend 模式选项
|
|
636
|
+
|
|
637
|
+
| 选项 | 类型 | 必需 | 描述 |
|
|
638
|
+
|--------|------|----------|-------------|
|
|
639
|
+
| `mode` | `"blend"` | 是 | 启用混合模式(`.9.png` 背景 + WebView) |
|
|
640
|
+
| `image` | `string` | 是 | 背景图片路径(支持 `.9.png`) |
|
|
641
|
+
| `localHtmlPath` | `string` | 否 | 自定义 HTML 文件路径 |
|
|
642
|
+
|
|
643
|
+
**Blend 模式工作原理:**
|
|
644
|
+
|
|
645
|
+
- **系统启动屏幕**:使用 `.9.png` 图片作为背景(Android 12+ 系统启动屏幕)
|
|
646
|
+
- **WebView 容器**:使用透明背景(推荐),以显示系统启动屏幕背景,实现视觉连续性
|
|
647
|
+
- **HTML 覆盖层**:在背景之上显示自定义 HTML 内容
|
|
648
|
+
- **过渡效果**:从系统启动屏幕到 WebView 启动屏幕的平滑过渡,无视觉间隙
|
|
649
|
+
|
|
650
|
+
此模式适用于以下场景:
|
|
651
|
+
- 需要系统启动屏幕的原生性能
|
|
652
|
+
- 需要 HTML/WebView 的丰富动画和交互性
|
|
653
|
+
- 需要系统启动屏幕和自定义启动屏幕之间的无缝视觉过渡
|
|
654
|
+
|
|
580
655
|
### 深色模式支持
|
|
581
656
|
|
|
582
657
|
通过在 `normal` 模式中添加 `dark` 配置来启用深色模式支持:
|
|
@@ -694,6 +769,28 @@ npx expo prebuild
|
|
|
694
769
|
- 为 Image View 添加宽度约束(默认 100pt)
|
|
695
770
|
4. 修改 `AppDelegate.swift` 以添加带有宽度约束的图片容器视图
|
|
696
771
|
|
|
772
|
+
#### Blend 模式
|
|
773
|
+
|
|
774
|
+
对于 Blend 模式,插件:
|
|
775
|
+
|
|
776
|
+
1. **复制背景图片**:将 `.9.png` 图片文件作为 `splash_background_image.{ext}` 放置在 `ios/{projectName}/` 目录
|
|
777
|
+
2. **复制 HTML 文件**:将 HTML 文件从 `expo-splash-web/dist` 或 `localHtmlPath` 放置到 `ios/{projectName}/` 目录
|
|
778
|
+
3. **修改 `SplashScreen.storyboard`**:设置全屏背景图片,使用 `scaleAspectFill` 内容模式(与 ResponsiveImage 模式相同)
|
|
779
|
+
4. **修改 `AppDelegate.swift`**:添加 WebView 覆盖层代码,使用透明背景(推荐)
|
|
780
|
+
|
|
781
|
+
**手动步骤**(如需要):
|
|
782
|
+
|
|
783
|
+
1. 将 `.9.png` 背景图片复制到 `ios/{projectName}/splash_background_image.{ext}`
|
|
784
|
+
2. 将 HTML 文件复制到 `ios/{projectName}/index.html`
|
|
785
|
+
3. 修改 `SplashScreen.storyboard`:
|
|
786
|
+
- 将 Image View 设置为使用 `splash_background_image` 图片
|
|
787
|
+
- 将 Content Mode 设置为 `Aspect Fill` 以实现全屏覆盖
|
|
788
|
+
- 设置背景颜色(备用)
|
|
789
|
+
4. 修改 `AppDelegate.swift`:
|
|
790
|
+
- 添加 WebView 容器代码(参见插件源代码中的模板)
|
|
791
|
+
- 将 WebView 容器背景设置为透明(推荐),实现无缝过渡
|
|
792
|
+
5. 将图片和 HTML 文件添加到 Xcode 项目文件引用
|
|
793
|
+
|
|
697
794
|
### 🤖 Android 配置
|
|
698
795
|
|
|
699
796
|
插件自动:
|
|
@@ -815,6 +912,45 @@ npx expo prebuild
|
|
|
815
912
|
```
|
|
816
913
|
7. 修改 `MainActivity.kt` 以添加带有固定宽度(默认 100dp)的图片容器视图
|
|
817
914
|
|
|
915
|
+
#### Blend 模式
|
|
916
|
+
|
|
917
|
+
对于 Blend 模式,插件:
|
|
918
|
+
|
|
919
|
+
1. **复制背景图片**:将 `.9.png` 图片作为 `splash_background_image.{ext}` 放置在 `android/app/src/main/res/drawable/`
|
|
920
|
+
2. **复制 HTML 文件**:将 HTML 文件从 `expo-splash-web/dist/index.html` 或 `localHtmlPath` 放置到 `android/app/src/main/assets/index.html`
|
|
921
|
+
3. **创建 CustomSplashActivity**:生成 `SplashScreen2Activity.kt`,使用透明 WebView 容器背景(推荐)
|
|
922
|
+
4. **修改 AndroidManifest.xml**:将 `SplashScreen2Activity` 添加为启动活动,将 `MainActivity` 主题设置为 `Theme.App.SplashScreen`
|
|
923
|
+
5. **修改 MainActivity.kt**:添加 WebView 容器代码,使用透明背景(推荐)
|
|
924
|
+
6. **修改 styles.xml**:更新 `Theme.App.SplashScreen` 以使用 `.9.png` 背景图片
|
|
925
|
+
7. **创建 colors.xml**:创建 `splashscreen_background` 颜色资源
|
|
926
|
+
8. **更新 build.gradle**:添加 `androidx.core:core-splashscreen` 依赖
|
|
927
|
+
|
|
928
|
+
**手动步骤**(如需要):
|
|
929
|
+
|
|
930
|
+
1. 将 `.9.png` 背景图片复制到 `android/app/src/main/res/drawable/splash_background_image.{ext}`
|
|
931
|
+
2. 将 HTML 文件复制到 `android/app/src/main/assets/index.html`
|
|
932
|
+
3. 在 `android/app/src/main/java/{packageName}/` 中创建 `SplashScreen2Activity.kt`:
|
|
933
|
+
- 将 WebView 容器背景设置为透明(推荐,参见插件模板)
|
|
934
|
+
4. 修改 `AndroidManifest.xml`:
|
|
935
|
+
- 将 `SplashScreen2Activity` 添加为启动活动
|
|
936
|
+
- 将 `MainActivity` 主题设置为 `Theme.App.SplashScreen`(与启动屏幕主题相同)
|
|
937
|
+
5. 修改 `MainActivity.kt`:
|
|
938
|
+
- 添加 WebView 容器代码
|
|
939
|
+
- 将 WebView 容器背景设置为透明(推荐),实现无缝过渡
|
|
940
|
+
6. 更新 `res/values/styles.xml`:
|
|
941
|
+
```xml
|
|
942
|
+
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
|
|
943
|
+
<item name="android:windowBackground">@drawable/splash_background_image</item>
|
|
944
|
+
</style>
|
|
945
|
+
```
|
|
946
|
+
7. 创建 `res/values/colors.xml`:
|
|
947
|
+
```xml
|
|
948
|
+
<resources>
|
|
949
|
+
<color name="splashscreen_background">#FFFFFF</color>
|
|
950
|
+
</resources>
|
|
951
|
+
```
|
|
952
|
+
8. 在 `build.gradle` 中添加 `androidx.core:core-splashscreen:1.0.1` 依赖
|
|
953
|
+
|
|
818
954
|
### 手动重新生成
|
|
819
955
|
|
|
820
956
|
如果您需要使用最新的插件更改重新生成原生项目:
|