安卓12开机画面图标

6
我想使用新的Android 12 API来创建启动画面,但如果我在主题中使用我的drawable图标作为参数windowSplashScreenAnimatedIcon,它会被拉伸。我该如何调整该图标的大小? 我的图标不是矢量图。我必须使用PNG文件。

你好!你能否检查一下我下面的答案? - sergpetrov
2个回答

5
很可能,您需要按照启动屏幕尺寸规范进行操作。 谷歌指出:
  • 带有应用标志背景的应用标志: 应为240×240 dp,并适合在直径为160 dp的圆形内。
  • 不带应用标志背景的应用标志: 应为288×288 dp,并适合在直径为192 dp的圆形内。

enter image description here


7
如何生成这些图标?我的意思是,我有一个图标,但如何根据这些指南设置它的宽度和高度? - Talha Akbar
1
@TalhaAkbar 你可以使用矢量编辑软件,例如 Figma。 - Risal Fajar Amiyardi
为什么图标的文档总是有额外的空间留给没有内容的图标呢? - android developer
@RisalFajarAmiyardi 但是没有dp的度量单位。我使用Inkscape。 - HasIEluS
@TalhaAkbar 你能做到这个吗?怎么做的? - HasIEluS
@HasIEluS 我创建了一个<layer-list>,并添加了可绘制对象并设置了它的大小。但这不是一个好的解决方案。 - Talha Akbar

0
在values-v31目录下创建2个值文件。
<style name="SplashScreenTheme" parent="Theme.SplashScreen">
    <item name="android:windowSplashScreenBackground">@color/color_121326
    </item>
    <item name="postSplashScreenTheme">@style/SplashScreen</item>
    <item name="android:windowSplashScreenAnimatedIcon">
        @drawable/ic_splash_center
    </item>
    <item name="splashScreenIconSize">@dimen/dp_100</item>
</style>

在values-v33中。
<style name="SplashScreenTheme" parent="Theme.SplashScreen">
    <item name="android:windowSplashScreenBackground">@color/color_121326
    </item>
    <item name="postSplashScreenTheme">@style/SplashScreen</item>
    <item name="android:windowSplashScreenAnimatedIcon">
        @drawable/drawable_splash
    </item>
    <item name="splashScreenIconSize">@dimen/dp_100</item>
</style>

在drawable_splash中。
<item
    android:width="@dimen/dp_100"
    android:height="@dimen/dp_100"
    android:gravity="center">
    <bitmap android:src="@drawable/ic_splash_center" />
</item>

我发现将图标调整到API33以上的大小是有效的。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接