簡體   English   中英

Xamarin 表單如何從圖庫中選擇圖像

[英]Xamarin forms How to pick a Image from Gallery

我創建了一個簡單的應用程序,我需要在內部圖庫中選擇一個圖像才能上傳它。 我用 XAm.plugin.media nuget 嘗試過,但它不起作用,它給出了錯誤存儲許可。 在Android Manifest中,沒有設置訪問內部存儲的字段,它只有外部存儲如何在Xamarin表單中訪問內部圖像

在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)]

來源: https : //docs.microsoft.com/en-us/xamarin/essentials/media-picker?tabs=android

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM