xamarin.android - Xamarin Oreo自适应图标

标签 xamarin.android android-8.0-oreo

你们中的任何人是否成功利用了Oreo中引入的适用于xamarin android的“自适应图标”?

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

我已遵循此链接中的指南,并且在使用Android Studio时可以使用...我觉得很奇怪吗?

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

最佳答案

多亏了this blog post,我才能够在Xamarin.Forms Android应用中使用自适应图标。

涉及的步骤

  • 使用Android Studios创建自适应图标Image Asset Studio(请注意,在编辑器首次初始化时,您可能需要一段时间才能在Android Studio中实际添加新的Image Asset。)
  • 创建启动器项目后,您可以在文件资源管理器中打开res目录。
  • 将所有mipmap-* -folder复制到Xamarin.Forms Android项目Resources目录中。
  • 更新AndroidManifest.xml以包含新的iconroundIcon Assets
  • <application android:label="MyApp"
                   android:icon="@mipmap/ic_launcher"
                   android:roundIcon="@mipmap/ic_launcher_round"
                   android:appCategory="productivity"></application>
    
  • 在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.android - Xamarin Oreo自适应图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47864285/

    相关文章:

    android - 如何使用 Xamarin/Monodroid 设置自定义标题

    android - 如何更改 StateListDrawable 中的颜色?

    安卓 O : Notification Channel localization

    android - startForeground() 总是在 Samsung 8.0 设备上显示弹出窗口

    android - Context.startForegroundService() 然后没有调用 Service.startForeground() 即使我停止了服务

    android - 由于 FirebaseInstanceIdReceiver 中的 Intent { act=com.google.android.c2dm.intent.RECEIVE 广播而导致 ANR

    xamarin - InputTransparent=true 在 Xamarin Forms Android 中不起作用

    c# - 如何在 ListView 中将网格嵌套到网格中

    android - Xamarin.Android:在 SMS Delivered Broadcast Receiver 中检测 SMS

    android - 错误 : adaptive icons with no fallback drawable for FCM notifications, 可能导致 Android Oreo 发生不可逆转的崩溃