我有一个我正在尝试创建的 map View ,但它比 map 实现更高级 由 Xamarin.Forms 提供。我想知道是否有用于嵌入 native View 的模式 主详细信息页面。
在示例图像中,顶部导航栏将在 Xamarin 中构建,以紫色突出显示的内容部分应根据平台单独创建。
最佳答案
这通常是渲染器可以接管的地方。
参见 Customizing Controls for Each Platform和 Forms2Native样本。
您将创建一个 MapContentPage 来扩展 ContentPage 并在顶部有一个属性:
[assembly: ExportRenderer (typeof (MapContentPage), typeof (MapContentPageRenderer))]
然后您将为 Android 创建一个名为 MapContentPageRenderer 的渲染器,并在其 OnElementChanged 中,您将使用“常规”Mono 为 Android 代码实例化 map 。
关于android - MasterDetailPage Xamarin Android 中的 native View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26347455/