android SplashScreen的标志是圆形的,而不是带圆角的正方形,为什么?

8dtrkrch  于 2024-01-04  发布在  Android
关注(0)|答案(1)|浏览(162)

我在Medium中使用过这个教程:https://medium.com/@radomir9720/android-splash-screen-easy-setup-for-both-11-version-and-lower-and-12-287ccb86f9c7
这是我的logo drawable:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="171dp"
    android:height="171dp"
    android:viewportWidth="171"
    android:viewportHeight="171">
  <path
      android:pathData="M55.38,28L114.62,28A27.38,27.38 0,0 1,142 55.38L142,114.62A27.38,27.38 0,0 1,114.62 142L55.38,142A27.38,27.38 0,0 1,28 114.62L28,55.38A27.38,27.38 0,0 1,55.38 28z"
      android:fillColor="#303030"/>
  <path
      android:pathData="M61.68,88.94C61.68,102.24 72.16,113.02 85.02,113.02C97.87,113.02 108.35,102.21 108.32,88.94C108.32,82.57 105.88,75.15 101.74,69.07C96.96,62.02 90.87,58.12 84.66,58.12C70.83,58.12 61.68,76.69 61.68,88.94ZM69.33,88.94C69.33,79.14 76.91,66.01 84.66,66.01C92.63,66.01 100.7,79.34 100.7,88.94C100.7,97.87 93.67,105.13 85.01,105.13C76.36,105.13 69.33,97.87 69.33,88.94Z"
      android:fillColor="#ffffff"
      android:fillType="evenOdd"/>
</vector>

字符串
这是应该看到的
x1c 0d1x的数据
和层列表xml:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:drawable="@color/Accent_900"/>
    <item
        android:drawable="@drawable/b4w_logo_splash"
        android:gravity="center"
    />
</layer-list>


但这是如何在应用程序中看到的



我该如何修复它?徽标是一个171 dp的清晰正方形,内部图像为114 dp(square/1.5)
我试着执行所有的步骤,在中等教程

vddsk6oq

vddsk6oq1#

根据这个documentation,Android本身屏蔽图像为圆形,所以我们不能显式地改变图标视图的形状,但我们可以做一些技巧来设置图标为方形圆角.您可以用inset属性来设置您的图像并根据需要调整大小.
我试过你的形象,这一个为我工作。

<inset xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/ic_egg"
    android:insetLeft="30dp"
    android:insetRight="30dp"
    android:insetTop="30dp"
    android:insetBottom="30dp"/>

字符串


的数据

相关问题