xamarin android应用程序:如何获取项目的资源文件夹

时间:2021-04-10 17:16:17

How can i get the Resources folder of my project like Resources/Drawable i need this to store Images on the app for later use

如何获得项目的Resources/Drawable等资源文件夹,以便在应用程序中存储图像供以后使用

I tryed:

如何提问:

var Path = (System.Environment.CurrentDirectory + "/Resources/Drawable");

But i didnt work because i use this in a .cs (Class File) thats defined in the map App_Code how can i get the Resources map i think there is an much easier way to get this.

但是我没有工作,因为我在map App_Code中定义的。cs(类文件)中使用了这个。cs(类文件)如何获得资源映射?

1 个解决方案

#1


3  

If you are trying to store images you get from somewhere the runtime, you probably shouldn't be using the resources directory. Instead, you should save them in a directory on the SD card, see this post: Android saving file to external storage

如果您试图存储从运行时获得的图像,您可能不应该使用资源目录。相反,您应该将它们保存在SD卡上的目录中,请参见本文:将Android保存文件保存到外部存储

Otherwise, if you're just trying to access resources that you've included while building your application, this Xamarin guide should tell you everything you need to know: http://docs.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_1_-_android_resource_basics/

否则,如果您只是试图访问在构建应用程序时包含的资源,那么这个Xamarin指南应该会告诉您所有您需要知道的内容:http://docs.xamarin.com/guides/android/application_原教旨s/resources_in_android/part_1__-_android_resource_basics/

#1


3  

If you are trying to store images you get from somewhere the runtime, you probably shouldn't be using the resources directory. Instead, you should save them in a directory on the SD card, see this post: Android saving file to external storage

如果您试图存储从运行时获得的图像,您可能不应该使用资源目录。相反,您应该将它们保存在SD卡上的目录中,请参见本文:将Android保存文件保存到外部存储

Otherwise, if you're just trying to access resources that you've included while building your application, this Xamarin guide should tell you everything you need to know: http://docs.xamarin.com/guides/android/application_fundamentals/resources_in_android/part_1_-_android_resource_basics/

否则,如果您只是试图访问在构建应用程序时包含的资源,那么这个Xamarin指南应该会告诉您所有您需要知道的内容:http://docs.xamarin.com/guides/android/application_原教旨s/resources_in_android/part_1__-_android_resource_basics/