作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 Crossmedia 进行多次拍照,我用它效果很好,但它会一次又一次地导航,但我不想要这个
bool isCamera = true;
while (isCamera)
{
file = await MediaPicker.TakePhotoAsync(new StoreCameraMediaOptions { SaveToAlbum = true, Name = "", Directory = "" });
if (file != null)
{
//save code}
else{
isCamera=false;
}
最佳答案
该插件不支持多选。所以我们需要使用各个平台的依赖服务来实现。
自己从图库中挑选媒体。检查这个Tutorial .
安卓
public void OpenGallery()
{
try
{
var imageIntent = new Intent(Intent.ActionPick);
imageIntent.SetType("image/*");
imageIntent.PutExtra(Intent.ExtraAllowMultiple, true);
imageIntent.SetAction(Intent.ActionGetContent);
((Activity)Forms.Context).StartActivityForResult(Intent.CreateChooser(imageIntent, "Select photo"), OPENGALLERYCODE);
Toast.MakeText(Xamarin.Forms.Forms.Context, "Tap and hold to select multiple photos.", ToastLength.Short).Show();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Toast.MakeText(Xamarin.Forms.Forms.Context, "Error. Can not continue, try again.", ToastLength.Long).Show();
}
}
对于 iOS,您可以使用插件 https://github.com/roycornelissen/GMImagePicker.Xamarin
关于xamarin.forms - 如何使用跨媒体多重拍照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66562883/
我是一名优秀的程序员,十分优秀!