Share via

AppAction's Icon not showing

jrahma 116 Reputation points
Feb 25, 2021, 10:31 PM

Hi,

I have started using AppAction in my Xamarin Form and it's working fine except the icon which is just showing as a black circle.

i have also noticed the same is here:

https://almirvuk.com/add-custom-actions-to-your-app-with-xamarin-essentials/

although he set the icons

So how can I show the icon from my resources?

I tried Logo and Logo.png but none worked.

Kindly help.

Thanks,
Jassim

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,377 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 80,526 Reputation points Microsoft External Staff
    Feb 26, 2021, 2:42 AM

    Hello,​

    Welcome to our Microsoft Q&A platform!

    I set the icon in the App.xaml.cs of Xamarin.Forms. Just with icon's name like following code

       protected override async void OnStart()  
               {  
                   try  
                   {  
                       await AppActions.SetAsync(  
                           new AppAction("app_info", title: "Add new note", icon: "hamburger"),  
                           new AppAction("Favourites", title: "View favourites", icon: "plus"));  
                   }  
                   catch (FeatureNotSupportedException ex)  
                   {  
                       // Log error and handle this Exception properly  
                   }  
               }  
    

    For Android, I put the image to drawable folder like following screenshot.

    72239-image.png

    Here is running screenshot.

    72255-image.png

    For iOS, I put the image to Assets like following screenshot.

    72301-image.png

    72219-image.png

    Here is running screenshot.

    72265-image.png

    But the hamburger icon do not show correctly. Based on my research, AppAction's the Icon achieved by UIApplicationShortcutIcon in the iOS., UIApplicationShortcutIcon has a limitation In the Apple's article, so when we set colorful icon, It only shows an outline with black background. It is by design.

    Icons should be square, single color, and 35x35 points, as shown in these template files and as described in Template Images in UIKit User Interface Catalog and in iOS Human Interface Guidelines.

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.