gpt4 book ai didi

xamarin - 如何在默认程序中打开文件?

转载 作者:行者123 更新时间:2023-12-02 21:21:12 25 4
gpt4 key购买 nike

我正在使用 Xamarin.forms 编写应用程序,我需要在 Droid 和 IOS 中打开 PDF 和 Doc 文档。有没有跨平台的方法来实现这一目标?也许有什么包?

最佳答案

现在,您可以通过在类中添加对 Xamarin.Essentials 的引用来使用 Launcher 类。

要通过另一个应用程序打开文件,请使用:

await Launcher.OpenAsync(new OpenFileRequest
{
File = new ReadOnlyFile(file)
});

其中 file 是文件或完整路径。

您可以在这里找到更多信息:https://learn.microsoft.com/en-us/xamarin/essentials/launcher?tabs=android

关于xamarin - 如何在默认程序中打开文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44392270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com