Forum Cross Platform with Xamarin

Common folders for Image and font assets?

I was curious if there were a way I could use a common folder to hold all my icons and fonts? for now I am only building the android project so it's not been an issue, but I am getting close to working on the iOS port for it. I was hoping to be able to manage the images within the PCL project, but I gather that's not possible. I would prefer to have a common source for all of my icons rather than having to keep multiple copies in multiple locations. I know that the various platforms probably have different dimensional requirements, but I can just keep all of them in the same place so modifications to specific icons can be checked and reflected in the same location.

Cheers!

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You can put your image or font in the PCL with EmbeddedResource. set image's Build Action: from None to EmbeddedResource. However I do not recommend to use this way, this way will affect your application's performance(like make I/O operation to read external file). The best way is put image separately(for android and iOS).

    https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=windows#embedded-images


    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • JKnottJKnott Member ✭✭✭

    I figured it would be something like that, but it never hurts to make sure.
    Thanks!

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    You are welcome, if reply is helpful, please click the Yes tab under the helpful answer. It will help others who have similar issue.

Sign In or Register to comment.