android - 使用 Xamarin 表单在 Xamarin 中共享图像和声音
问题描述
我们目前正在为一个大学项目开发一个多平台应用程序,并决定使用 Xamarin。我们的带有 sqlite 的数据库以及业务逻辑和共享资源应该位于 xamarin 形式中,而 View Controller 和 View 位于本机 xamarin.android 和 xamarin.Ios 中。
我们似乎无法在 Android 上的本机 ImageView 中使用 Xamarin.Forms 图像。
浏览 Xamarin 文档 ( https://docs.microsoft.com/de-de/xamarin/xamarin-forms/user-interface/images?tabs=windows ) 中的 EmbeddedImages 部分时,以下 C# 代码似乎没有在我们的项目中工作。
var embeddedImage = new Image { Source = ImageSource.FromResource("WorkingWithImages.beach.jpg", typeof(EmbeddedImages).GetTypeInfo().Assembly) };
我们可以将源设置为 IamgeSource.FromResource("source") 但typoeof(EmbeddeImages)... 不起作用。即使 BuildAction 正确设置为 Embedded 资源。
此外,我们无法真正理解“使用 XAML”部分的重点,即放置 C# 代码以及 XAML 的位置。
这就是为什么我们尝试将 Xamarin.Forms.Image 从逻辑传递到位图的原因: https ://medium.com/@hakimgulamali88/a-helper-for-converting-a-xamarin-forms-imagesource-to -the-respective-native-images-56a5aaf98156
但是当调试应用程序时变黑并且控制台显示多个威胁正在启动和完成。应用程序保持无响应。
有什么建议吗?
我们感谢任何帮助。谢谢你。
解决方案
推荐阅读
- ruby-on-rails-3 - 如何在我的 rspec 测试之前输入一些数据
- javascript - 在滚动时填充 SVG 笔划并在向上滚动时移除填充
- java - 如何在 Unix 服务器上的 Java 中拆分具有不同分隔符的复杂字符串
- android - 复制文件时出错:尝试将数据库从资产文件夹中复制出来时,InputStream 似乎失败了
- android - Firebase 错误:无法解决:com.google.firebase:firebase-database:16.0.6
- powershell - PowerShell 重命名项子字符串
- c# - 当我们将上传 Excel 传递给控制器中的操作方法时,如何在 ajax 调用中添加更多参数
- outlook - 为什么我们仍然需要电子邮件模板的 VML 标签?
- javascript - 在 TypeScript 中将内部对象属性更改为数组
- android - java.lang.RuntimeException: , java.lang.IllegalStateException: 谷歌播放控制台中的崩溃报告