Android 打开图像进行共享

Android 打开图像进行共享,android,xamarin,share,preview,Android,Xamarin,Share,Preview,我有带imageview的Android Xamarin应用程序 OnClik I午餐打算预览图像 File file = new File(photoPath); Intent intent = new Intent(Intent.ActionView); intent.SetDataAndType(Uri.FromFile(file), "image/*"); intent.SetFlags(ActivityFlags.NoHistory); StartActivity(intent);

我有带imageview的Android Xamarin应用程序 OnClik I午餐打算预览图像

File file = new File(photoPath);
Intent intent = new Intent(Intent.ActionView);
intent.SetDataAndType(Uri.FromFile(file), "image/*");
intent.SetFlags(ActivityFlags.NoHistory);
StartActivity(intent);
从应用程序中,我选择“多媒体资料” 打开图像时,没有共享选项

当我从设备打开图像时,“多媒体资料”具有共享选项

图像在预览前保存到SD卡。
我做错了什么?

使用
Intent.ACTION\u SEND
进行操作,您将获得共享选项


还可以尝试使用
Intent.ACTION\u GET\u CONTENT

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), 1);

对我有效的解决方案

Intent intent = new Intent();
intent.PutExtra(Intent.ActionView, photoPath);
intent.SetType("image/*");
StartActivity(Intent.CreateChooser(intent, "Select Picture"));

现在,我在gallery中打开了我的图像,我也可以使用共享选项

当我使用操作时,发送gallery不在应用程序中可供选择当我选择任何其他应用程序时,我不获取预览,只发送弹出窗口。我正在尝试获取预览和发送选项也尝试使用
意图。操作\u获取内容
。感谢您的代码,但现在它只会打开我设备上的所有图像,免费提供给borws,我正在尝试预览一张图像,并在问题中显示共享按钮。Android版本:您解决了吗?