使用什么 mipmap 或drawable

Use*_*191 4 android manifest drawable

我是 Android 新用户,正在使用 Android Studio 1.3。我想创建简单的启动屏幕,为此,我创建不同的可绘制文件夹,在其中存储启动屏幕背景图像。我从相应的 mipmap 文件夹中复制所有 ic_launcher 并将它们粘贴到相应的可绘制文件夹中。并更改清单中的图标路径,

 <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud)

到,

 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)

但这给了我错误,

Error:(14, 24) No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher').
Run Code Online (Sandbox Code Playgroud)

我的问题是,

  1. 我们是否总是需要将应用程序图标存储在 mipmap 文件夹中?为什么?

  2. 何时使用 mipmap 和drawable?

Nik*_*ono 6

Android 团队将使用 mipmap 用作启动器图标描述为最佳实践。您获得的优势是,您可以将资源保留在所有设备密度的 mipmap 文件夹中,然后从可绘制文件夹中删除与特定用户设备密度不相关的其他资源。

例如,用户拥有分类为 xxhdpi 的设备。apk 中所有其他密度(例如 xxxhdpi)的可绘制资源不是必需的,可以删除。

参考