Xamarin是一个由Xamarin.iOS,Xamarin.Android,Xamarin.Mac和Xamarin Test Cloud组成的平台。它允许您编写适用于iOS,Android和Mac的跨平台本机应用程序,并在整个生命周期内关注您的应用程序。 Xamarin.Forms的引入支持iOS,Android和Windows的Native UI开发
如何在 Xamarin Forms 中缩放 WebView?
我无法缩放 Xamarin.Forms 中的 Web 视图。下面是代码,请有人帮助我。谢谢 我无法缩放 Xamarin.Forms 中的 Web 视图。下面是代码,请有人帮助我。谢谢你 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="highchart.MainPage"> <ScrollView> <WebView VerticalOptions="FillAndExpand" WidthRequest="80" HorizontalOptions="FillAndExpand"> <WebView.Source WebView.EnableZoomControls="true" WebView.ScalesPageToFit = "true"> <HtmlWebViewSource x:Name="HighChart"/> </WebView.Source> </WebView> </ScrollView> </ContentPage> 针对 Android 特定(在共享项目 [FORMS] 内) XAML 解决方案: <ContentPage ... xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"> <WebView Source="https://www.xamarin.com" android:WebView.EnableZoomControls="true" android:WebView.DisplayZoomControls="true" /> C# 解决方案: using Xamarin.Forms.PlatformConfiguration; using Xamarin.Forms.PlatformConfiguration.AndroidSpecific; ... WebView.On<Android>().EnableZoomControls(true); WebView.On<Android>().DisplayZoomControls(true); 我在iOS上的Android上测试过,看来这个问题只出现在Android上。 您可以创建一个自定义渲染器来实现缩放功能,它在我这边工作得很好。 [assembly: ExportRenderer(typeof(WebView), typeof(CustomWebViewRenderer))] namespace PDFPOC.Droid { public class CustomWebViewRenderer : WebViewRenderer { public CustomWebViewRenderer(Context context) : base(context) { } protected override void OnElementChanged(ElementChangedEventArgs<WebView> e) { base.OnElementChanged(e); if (e.NewElement != null) { Control.Settings.AllowUniversalAccessFromFileURLs = true; Control.Settings.SetSupportZoom(true); Control.Settings.BuiltInZoomControls = true; Control.Settings.DisplayZoomControls = true; } } } }
我正在使用输入控件(.Net 7),键盘类型专门设置为数字,因为不需要输入字母文本,并且会导致问题,因为它将数据发送到 BT 设备并且是
我正在使用 Visual Studio 2022 Community、Xamarin.Forms 和 Android 的组合来开发一个应用程序。 在调试模式下,我放置了断点,但它们不会停止。 有什么需要我做的吗
如何使用 MAUI .net 8 检查和修复 HotReload?
我无法在 iOS 或 Android 上使用 .net 8 和 MAUI 的 Visual Studio 2022 Mac 上使用热重载。 它在 IDE 设置中启用: 并且在运行时也显示为已连接: 但是当做...
.NET MAUI CollectionView SwipeView 更改 TextColor
所以我将 SwipeView 与 .NET MAUI 的 CollectionView 结合使用,我想知道如何更改 TextColor。 所以我将 SwipeView 与 .NET MAUI 的 CollectionView 结合使用,我想知道如何更改 TextColor。 <SwipeView.RightItems> <SwipeItems> <SwipeItem BackgroundColor="LightGray" IconImageSource="Icon.png" Text="Unread"/> </SwipeItems> </SwipeView.RightItems> 我似乎无法找到直接的方法,我是否需要以某种方式本地执行此操作? 如果是的话有人可以指导我吗? 您可以使用SwipeItemView来实现: <CollectionView ...> <CollectionView.ItemTemplate> <DataTemplate > <SwipeView> <SwipeView.RightItems> <SwipeItems> <SwipeItemView> <StackLayout BackgroundColor="red"> <Label Text="Delete" TextColor="Aqua"/> </StackLayout> </SwipeItemView> <SwipeItemView> ... </SwipeItemView> </SwipeItems> </SwipeView.RightItems> <HorizontalStackLayout Padding="2"> <Label Text="{Binding ...}"/> <Label Padding="50,0,0,0" Text="{Binding ...}"/> </HorizontalStackLayout> </SwipeView> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> 有关更多信息,您可以参考文档:自定义刷卡项目。
XAML > ViewModel 命令参数 - 无法从对象转换为布尔值?
我有这个XAML 我有这个XAML <Label.GestureRecognizers> <TapGestureRecognizer Command="{Binding TapGestureForUpdateCategories, Source={x:Reference MainPage}}" CommandParameter="false" /> </Label.GestureRecognizers> 以及我的 ViewModel 中的这段代码 public Command TapGestureForUpdateCategories => new Command(val => { App.DB.UpdateAllCategoryGroups(val); App.DB.UpdateAllCategory(val); }); 我试图从 XAML 传递参数 true 或 false,但在命令 C# 代码中,val 下有一行显示“无法从对象转换为 bool”。谁能帮我解决这个问题吗? 修改如下,我们可以通过TapGestureRecognizer.CommandParameter里面的x:type定义我们想要的类型 <Label.GestureRecognizers> <TapGestureRecognizer Command="{Binding TapGestureForUpdateCategories, Source={x:Reference MainPage}}"> <TapGestureRecognizer.CommandParameter> <x:Boolean>True</x:Boolean> </TapGestureRecognizer.CommandParameter> </TapGestureRecognizer> </Label.GestureRecognizers> 你可以使用这个方法
在同一个 UIViewController 中第一个 UITableView 的 RowClick 上绑定第二个 UITableView - ios Xamarin
我在同一个 UIViewController 中有两个 UITableView。 tblView1 和 tblView2。 两个 TableView 都动态地提供数据。 现在我的问题是:我想在 tblView2 的基础上加载数据
SQLite-net-pcl - 始终返回 ID 为 0 (Xamarin)
由于 Android 7.0 SQlite 问题,我最近从 SQLite.NET 迁移到 SQLite-net-pcl。 在此过程中,我更新了所有库,并且在插入/删除等方面一切正常...
Azure Pipelines iOS 预配配置文件已安装但找不到
我的 Xamarin 应用程序构建管道失败,并显示找不到指定的 iOS 配置文件“”。尽管开发人员证书和配置文件已安装...
Mono.AndroidTools.AdbException:尝试读取流末尾(在 Visual Studio 上)
我正在使用 Xamarin / Visual studio for Mac 构建应用程序 我已经在 Mac mini 上有一个项目了。 现在我将该项目转移到了新的 iMac 上。 编译就好了。但是当尝试部署到物理上时
有没有正确的方法将现有的 SQLite 数据库添加到 Xamarin 项目?
我找到的每个示例都会为您创建数据库,然后让您创建表并在代码中填充它们。不过,我的问题是我想在其他地方创建并填充数据库(
创建 ImageButton 函数以在项目突出显示为最喜欢的 xamarin 表单时进行更改时出现问题
我正在使用 Xamarin 和 MVVM 创建一个项目,我想知道如何创建一个按钮,其中我将有一个灰色的最喜欢的图像,当我单击时,我想将其更改为红色的最喜欢的图像。 ..
我正在制作一个 UWP xamarin 表单应用程序,它工作正常,但是我必须在修复另一个问题时更改一些内容,因为现在主页在启动时不会初始化。该应用程序...
MSBuild 17 的 Xamarin.Android Azure 构建失败
我有一个 Xamarin.Forms 应用程序,其 Azure 构建管道在 macos-12 代理上运行,我们使用该代理生成 .apk 文件以部署到 Google Play 商店。 Azure 管道正在使用 Xamarin。
我正在使用 Nuget CommunityToolkit.Maui.Views。我的毛伊岛应用程序我也使用 viewModels。现在我想通过 viewmodel 方法显示我的自定义对话框。但 this.ShowPopup(new DialogPopup()); ...
我需要在 Xamarin 中填写带有输入的表单,并将它们发送到我的 API 页面。 我已经尝试在“Postman”中发送数据并且它正确保存了它,但我想知道如何发送我...
如何在 Xamarin 中获取 Firebase Cloud Messaging 令牌?
我有一个 Xamarin Android 应用程序,我需要获取 Firebase Cloud Messaging Token。 我在我的 Android 项目中添加了一个包含以下类的文件: [服务] [IntentFilter(new[] { "com.google.
如何将图像读入ImageSource?我想从此 Get 方法获取的源是一个 jpg 文件,我想将其放入 ImageSource 中并返回它。 这就是我通常获取 Json 数据的方式:...
如何在同一台计算机上安装 Xamarin 和 MAUI 的 Xcode 版本?
我一直在 Visual Studio for Mac 中维护我的 Xamarin 应用程序,并决定使用 Visual Studio for Windows 将其迁移到 MAUI。我已升级到 MacOS Sonoma,并找到 Xcode 14.3.1(X 需要...
如何解决 Xamarin.Firebase.iOS.Core - 8.10.0.1 nuget 安装错误
错误找不到路径的一部分 'C:\Users ivek.nuget\packages\xamarin.firebase.ios.core\8.10.0.1\lib\xamarinios10\Firebase.Core.resources\GoogleUtilitiesComponents.xcframework\ios -