Xamarin Oreo自适应图标 [英] Xamarin Oreo Adaptive Icons

查看:105
本文介绍了Xamarin Oreo自适应图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你们中的任何人都成功利用了Oreo中引入的适用于xamarin android的自适应图标"吗?

Did any of you successfully make use of the "Adaptive Icons" for xamarin android, introduced in Oreo?

如果.png图像放置在Drawable文件夹中,但如果将它们放置在MipMap文件夹中,则我设法使它工作.

I managed to make it work, if the .png images are placed in the Drawable-folders, but not if they are placed in the MipMap-folders.

我已遵循此链接中的准则,并且在使用Android Studio时可以使用...我认为很奇怪吗?

I have followed the guidelines in this link, and it works when using Android Studio... weird I think?

https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive.html

推荐答案

感谢

Thanks to this blog post I was able to use adaptive Icons in my Xamarin.Forms Android app.

涉及的步骤

  1. 使用Android Studios创建自适应图标 Image Asset Studio (请注意,在编辑器首次初始化之前,您可能需要一段时间才能在Android Studio中实际添加新的Image Asset.)
  2. 创建启动器项目后,您可以在文件资源管理器中打开res目录.
  3. 将所有mipmap-*文件夹复制到Xamarin.Forms Android项目Resources目录中.
  4. 更新AndroidManifest.xml以包含新的iconroundIcon资产
  1. Create an adaptive Icon using Android Studios Image Asset Studio (note that it takes a while before you can actually add a new Image Asset in Android Studio as the editor is first initializing.)
  2. Once the Launcher Item is created you can open the res directory in file explorer.
  3. Copy all mipmap-*-folder into the Xamarin.Forms Android Project Resources directory.
  4. Update the AndroidManifest.xml to contain the new icon and roundIcon asset

<application android:label="MyApp"
               android:icon="@mipmap/ic_launcher"
               android:roundIcon="@mipmap/ic_launcher_round"
               android:appCategory="productivity"></application>

  1. 在MainActivity中还更新IconRoundIcon

namespace MyApp.Droid
{
    [Activity(Label = "MyApp", Icon = "@mipmap/ic_launcher", RoundIcon = "@mipmap/ic_launcher_round", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {

这篇关于Xamarin Oreo自适应图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆