【问题标题】:How to use the default launcher icon provided in android studio project as an ImageView (as is)?如何使用 android studio 项目中提供的默认启动器图标作为 ImageView(原样)?
【发布时间】:2020-11-19 20:57:59
【问题描述】:

我想使用 android studio 中提供的默认启动器图标作为 ImageView。我在 imageView 中使用了 android:src="@drawable/ic_launcher_background" XML 标签

但我得到了这个结果:

但我想在我的 ImageView 中使用这个:

【问题讨论】:

  • "@mipmap/ic_launcher" ?

标签: android android-studio android-imageview android-icons


【解决方案1】:

试试这个

android:src="@mipmap/ic_launcher"

希望这会有所帮助...随时要求澄清...

【讨论】:

    【解决方案2】:

    你正在为这个ImageView设置ic_launcher_background,你明白了

    在 Android 7 应用程序图标之前是单个图像,通常称为 ic_launcher。奥利奥介绍了Adaptive Icons,它有两层——背景和图标/标志本身。所以您需要两个ImageViews 或LayerDrawable,第二层/顶层将是您的图标/徽标(ic_launcher_foreground?检查您的drawablemipmap 文件夹)

    请注意,背景层可能会在设备启动器中出现一些切口 - 可能是方形的,也可能是圆形的,圆角全部或只有一个等。前景/图标本身也可能会移动一点,就像上面链接下的可视化一样 - 当你在较新的设备上使用旧图标 ic_launcher 它不会与设备启动器中显示的完全相同

    【讨论】:

      【解决方案3】:

      android studio提供的默认图标其实是两个不同drawable的组合。请参见下图(您可以在项目中检查相同的内容)。您可以通过将一个可绘制对象堆叠在另一个之上(这不是一个好主意)将图标用作 ImageView,或者您也可以直接使用android:src="@mipmap/ic_launcher"。正如@Vishnu 所说。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-06-15
        • 1970-01-01
        • 2016-11-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-21
        相关资源
        最近更新 更多