5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flutterアプリにスプラッシュスクリーンを設定する

Posted at

Flutterアプリにスプラッシュスクリーンを設定する方法のメモです。
今回紹介する方法以外にも、プラグインを利用する方法があるみたいです。

また、各大きさに対応した画像の用意にはここが便利です。

設定方法

Android

  1. launch_background.xmlのlayer-list内にitemを追加
$PROJECT_ROOT/android/app/src/main/res/drawable/launch_background.xml
<item>
    <bitmap
        android:gravity="center"
        android:src="@mipmap/sample_logo" />
</item>
  1. Androidmanifest.xmlのmeta-dataを編集(label,iconを追加)
$PROJECT_ROOT/android/app/src/main/AndroidManifest.xml
<meta-data
    android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
    android:label="flutter_splash"
    android:icon="@mipmap/sample_logo"
    android:value="true" />
  1. 下記画像を格納する
  • $PROJECT_ROOT/android/app/src/main/res/drawable/mipmap-hdpi/sample_logo.png
  • $PROJECT_ROOT/android/app/src/main/res/drawable/mipmap-mdpi/sample_logo.png
  • $PROJECT_ROOT/android/app/src/main/res/drawable/mipmap-xhdpi/sample_logo.png
  • $PROJECT_ROOT/android/app/src/main/res/drawable/mipmap-xxhdpi/sample_logo.png
  • $PROJECT_ROOT/android/app/src/main/res/drawable/mipmap-xxxhdpi/sample_logo.png

iOS

  1. 下記画像を格納する1
  • ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
  • ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@x2.png
  • ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@x3.png

参考

  1. 画像名を変更したい場合は、同じディレクトリ内のContents.jsonを編集する

5
7
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?