【问题标题】:How to set size for launch screen icon?如何设置启动屏幕图标的大小?
【发布时间】:2020-03-12 22:51:57
【问题描述】:

我正在尝试设置一个启动屏幕,它将无缝地流入个人启动屏幕中。

目标是我的徽标以 Launch 和 Splash 为中心,也就是说,距离仅纵向应用程序的左右各 10 像素。

我不明白我需要多大的图像才能在 Android 上正确设置。我有大小不一的可绘制文件夹,但它们不适合。除了在 Android xml 中将图像“居中”之外,我基本上不知道如何使其“适合宽度”。

在 iOS 上,我的图标显示在 LaunchScreen.storyboard 的中心,但非常小 (96x96)。如果我手动调整图像大小以适应我想要的方式(在 Xcode 视图场景中),当我运行应用程序时,我会收到一条警告,说视图没有解锁约束,它将显示为原始的小尺寸。

【问题讨论】:

    标签: android ios flutter


    【解决方案1】:

    启动屏幕图标使用适配功能

    例如

    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Center(
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: Image.asset('repo/intro.jpg' width: 100 , height: 100, fit: BoxFit.fill,),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
    

    https://api.flutter.dev/flutter/painting/BoxFit-class.html

    Apple 推出 Storyboard 也很适合

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-13
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      • 2020-11-01
      • 1970-01-01
      • 2011-07-04
      相关资源
      最近更新 更多