简体   繁体   中英

Using vector drawable as Android app icon

After creating an Android Studio 'Phone and Tablet' project using Material3 for Jetpack Compose, there appears to be a superfluous amount of image files created, despite the minimum API being 30 (Android 11). Why in the mipmap folder has a whole bunch of raster images been generated, when for years, developers have been encouraged to use vector drawables for their app icons? Even the XML files seem to be in a folder for API 26. Is that really necessary when an app targets API 30? What should be done with the files in the ic_launcher and ic_launcher_round folders ending in .webp ?

AndroidManifest.xml

<application
    android:allowBackup="true"
    android:dataExtractionRules="@xml/data_extraction_rules"
    android:fullBackupContent="@xml/backup_rules"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.MyApp"
    tools:targetApi="31">
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:label="@string/app_name"
        android:theme="@style/Theme.MyVectorApp">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

'Project' pane in Android Studio

在此处输入图像描述

  1. WebP is an image format that is developed by Google, focuses mainly on optimization and quality, more on that here
  2. those generated images are pretty necessary, because they allow the apps icon to adapt to screen size, as shown here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM