I am working on a multiplatform (Android/iOS) Xamarin.Forms app.
I have put a TabbedPage. I want to define an Icon for each page. I have tried do set Icon Propery in XAML file:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="XXXX.YYYY">
<TabbedPage.Children>
<ContentPage Title="Recherche" Icon="search.png">
I have an error in Xamarin preview and a blank app when i try it in iOS simulator.
My question is: Where should i put search.png file?
In shared project? In a particular subfolder?
In each iOS/Android subproject?
The image assets need to be on each platform specific project so that they are correctly sized, named and formatted for each OS.
Read this article to get a better understanding about images: Working with Images
iOS - Place images in the Resources folder with Build Action: BundleResource. Retina versions of the image should also be supplied - two and three times the resolution with a @2x or @3x suffixes on the filename before the file extension (eg. [email protected]).
Android - Place images in the Resources/drawable directory with Build Action: AndroidResource. High- and low-DPI versions of an image can also be supplied (in appropriately named Resources subdirectories such as drawable-ldpi, drawable-hdpi, and drawable-xhdpi).
Windows Phone - Place images in the application's root directory with Build Action: Content.
Windows/UWP - Place images in the application's root directory with Build Action: Content.
After you have correctly placed the images, you can properly use them with for example Icon="search.png"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With