[英]Xamarin forms How to pick a Image from Gallery
I created a simple app I need to select an image in internal Gallery in order to upload it.我创建了一个简单的应用程序,我需要在内部图库中选择一个图像才能上传它。 I tried it with XAm.plugin.media nuget But it does not work it gives error Storage pErmission.
我用 XAm.plugin.media nuget 尝试过,但它不起作用,它给出了错误存储许可。 In Android Manifest, There is no field to set the access to internal storage it only has external storage How to access internal Image in Xamarin forms
在Android Manifest中,没有设置访问内部存储的字段,它只有外部存储如何在Xamarin表单中访问内部图像
In the Android project, open the AssemblyInfo.cs file under the Properties folder and add:在Android项目中,打开Properties文件夹下的AssemblyInfo.cs文件,添加:
// Needed for Picking photo/video
[assembly: UsesPermission(Android.Manifest.Permission.ReadExternalStorage)]
// Needed for Taking photo/video
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
[assembly: UsesPermission(Android.Manifest.Permission.Camera)]
// Add these properties if you would like to filter out devices that do not have cameras, or set to false to make them optional
[assembly: UsesFeature("android.hardware.camera", Required = true)]
[assembly: UsesFeature("android.hardware.camera.autofocus", Required = true)]
Source: https://docs.microsoft.com/en-us/xamarin/essentials/media-picker?tabs=android来源: https : //docs.microsoft.com/en-us/xamarin/essentials/media-picker?tabs=android
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.