具有Android绑定(.jar)的Xamarin表单 [英] Xamarin forms with Android Binding (.jar)
问题描述
如何使用Xamarin Forms中通过Android绑定(.jar)生成的.dll?
How can I use a .dll generated with Android Binding (.jar) from Xamarin Forms?
例如在此 Picasso android绑定,我可以在Xamarin.Android中成功使用.dll,但我不知道如何在Xamarin Forms中使用它.
For example in this Picasso android binding, I can successfully use the .dll in Xamarin.Android, but i do not know how to use it in Xamarin Forms.
推荐答案
您不能这样做!
Xamarin.Forms
绑定(.dll)和Xamarin.Android
绑定(.dll)确实具有相同的扩展名,但它们彼此不兼容.由于您的Xamarin.Forms
项目(PCL,.NetStandard或Shared Project)和您的Xamarin.Android
(Android Native)项目是不相同的,并且像其他扩展名一样,.dll
也针对特定目标受众进行了开发,因此,您创建的Picasso.dll
永远无法直接定位Xamarin.Forms.
Xamarin.Forms
Bindings (.dll) and Xamarin.Android
Bindings (.dll) do have the same extensions but they are not compatible with each other. Because your Xamarin.Forms
project (PCL,.NetStandard or Shared Project) and your Xamarin.Android
(Android Native) project are not the same and a .dll
like any other extension is made for a particular target audience, in this case, the Picasso.dll
you make can never target Xamarin.Forms directly.
您可以做的是创建一个自定义渲染器,可以在相应的Android和iOS项目中使用这些本机库.但是制作这些渲染器本身会很痛苦.
What you can do is create a custom renderer that can use these native libraries in respective Android and iOS project. But making those renderer's will be a pain in themselves.
解决方案
当前的Xamarin社区非常强大,有很多在线图书馆可供您使用,例如Picasso
.
The Xamarin community in the current times is quite strong there are a lot of libraries available online which you can use to do what Picasso
for example does.
有一个出色的Xamarin.Forms库可以完成Picasso
的用途, FFImageLoading 由daniel-luberda
.
There is an excellent Xamarin.Forms library that does what Picasso
is used for, FFImageLoading by daniel-luberda
.
该库已被社区广泛使用,并且是免费的,可以在 NuGet .
The library is widely used by the community and is free and can be downloaded on NuGet.
作者对其进行了充分的文档记录和良好的维护,因此在图书馆维护方面没有后顾之忧.
It is well documented and well maintained by the author so there are no worries when it comes to library maintenance.
我希望这可以帮助您解决/解决您的查询.
I hope this helps you with/solves your query.
如有疑问,请随时回复.
In case of questions feel free to revert.
这篇关于具有Android绑定(.jar)的Xamarin表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!