如何在Xamarin.Forms中更改应用程序图标? [英] How to change application icon in Xamarin.Forms?
问题描述
我替换了所有位置的所有图像(这意味着在可绘制文件夹,所有Windows Assets文件夹和iOS Resources文件夹中),但是它仍然显示了该应用程序的默认Xamarin图标.我也尝试了这段代码,但是它似乎也不起作用.有人可以告诉我解决方案吗?
I replaced all the images everywhere (by this I mean in drawable folders and all Windows Assets folders and iOS Resources folder), but it still shows me the default Xamarin icon for the app. I tried this code, too, but it doesn't seem to work either. Can someone tell me the solution?
[assembly: Application(Icon = "@drawable/icon")]
推荐答案
对于Android,请尝试如下设置图标应用程序:
For Android try to set the icon app like this:
[Activity(Icon = "@drawable/icon")]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
.....
}
确保已更改所有可绘制文件夹(drawable,drawable-hdpi,drawable-xhdpi和drawable-xxhdpi)上的所有图标图像.
Make sure that you have changed all the icon images on all drawable folders ( drawable, drawable-hdpi, drawable-xhdpi and drawable-xxhdpi ).
对于iOS,我喜欢使用Asset Catalogs设置应用程序图标和启动屏幕,在这里您可以找到使用方法的指南:
For iOS I like set the app icons and splash screen with Asset Catalogs, here you can find a guide to how to use it:
https://developer.xamarin.com/guides/ios/application_fundamentals/working_with_images/app-icons/
这篇关于如何在Xamarin.Forms中更改应用程序图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!