xamarin 相关问题

Xamarin是一个由Xamarin.iOS,Xamarin.Android,Xamarin.Mac和Xamarin Test Cloud组成的平台。它允许您编写适用于iOS,Android和Mac的跨平台本机应用程序,并在整个生命周期内关注您的应用程序。 Xamarin.Forms的引入支持iOS,Android和Windows的Native UI开发

获取iOS .NET MAUI中当前的ViewController

我正在将必须的 Xamarin Forms 代码移植到 .NET MAUI,但是我在那里获取当前视图控制器的代码不起作用,如何在 MAUI 中获取当前 ViewControler 相关代码h...

回答 1 投票 0

Azure DevOps 管道与发布管道

我们有一个包含两个 C# 解决方案(Xamarin 和 WPF)的存储库。每个解决方案还具有多个可执行项目。 目前我们每个项目都有多个管道。但我觉得这样更好...

回答 1 投票 0

Mvvmcross Android - 错误膨胀类:ClassNotFoundException

尝试膨胀 xml 文件时,我的 OnViewModelSet() 函数出现错误。 打电话时 LayoutInflater inflater = LayoutInflater.From(this); View mainView = inflater.Inflate(Resou...

回答 2 投票 0

MAUI:OpenAppPackageFileAsync 不想在 Windows 11 上打开我的文件

我正在使用下面的代码来读取我的毛伊岛项目中包含的文本文件。该代码是模板项目的一部分。我已将其设置为毛伊岛资产。 当我在 Android 上运行它时,它可以工作,W...

回答 2 投票 0

有没有办法在xamarin的google应用程序中使用更新

我想知道是否有nuget包或者google是否为xamarin.forms提供了这个API? 我看到它只适用于 kotlin 和本机 java 参考:https://developer.android.com/guide/

回答 3 投票 0

Xamarin 中可以模糊背景吗?

我尝试了一些东西,但唯一的方法是在github上安装和使用它们。有没有办法简单地模糊 xaml 文件? 例如 我想模糊网格背景。这可能吗?

回答 3 投票 0

Android、Xamarin:获取 SD 卡的文件路径

我目前正在开发一个应用程序,它可以通过您的手机并列出所有可用的 MP3 文件。我设法完成了这项工作并搜索了内部存储中的所有内容,但没有成功...

回答 5 投票 0

在 .NET MAUI 库中添加 `Xamarin.AndroidX.Biometric` 会引发异常

当我将 Xamarin.AndroidX.Biometric 添加到 Maui 类库,然后尝试在我的项目中使用此库时,它开始抛出以下错误。关于可能导致此问题的任何线索? 你可以查...

回答 1 投票 0

VS 2022无法启动Android模拟器

我刚刚将 Visual Studio 从 2019 年更新到 2022 年。使用 2019 版本时没有遇到任何问题,模拟器启动并运行良好。但自从我安装了2022之后,emu...

回答 4 投票 0

Xamarin Android Visual Studio 2022 - 需要更改我的 Android 应用程序中的后退箭头颜色(左上角)

我需要更改 Android 应用程序中的后退箭头颜色。 我尝试了一些解决方案,但没有一个对我有用。

回答 1 投票 0

如何使用 MVVM 模式在 Xamarin 中缩放 ListView 中的图像?

我是 Xamarin 的新手,特别是 MVVM 的新手。我有一个 ListView,它向我显示图像。 我是 Xamarin 的新手,特别是 MVVM 的新手。我有一个 ListView,它正在向我显示图像。 <ListView ItemsSource="{Binding Urls}" IsVisible="True" VerticalScrollBarVisibility="Always" HorizontalScrollBarVisibility="Always" HorizontalOptions="Fill" VerticalOptions="Fill" HasUnevenRows="True"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Orientation="Vertical" HorizontalOptions="Fill" VerticalOptions="FillAndExpand" Padding="2"> <ffimageloading:CachedImage Source="{Binding .}" Aspect="AspectFill" Margin="15"> <ffimageloading:CachedImage.GestureRecognizers> <TapGestureRecognizer Command="{Binding Source={x:Reference ImgListView},Path=BindingContext.ImageDoubleTappedCommand}" /> </ffimageloading:CachedImage.GestureRecognizers> </ffimageloading:CachedImage> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> 现在我想要通过双击和捏合进行缩放的缩放行为。 我在互联网上找到了不同的链接,但这些链接没有实现 MVVM。 例如:https://www.c-sharpcorner.com/article/zoom-in/。 如何在 MVVM 中获得缩放功能? 我只是使用后面的代码来触发事件并使用那里的缩放逻辑: <TapGestureRecognizer Tapped="TapGestureRecognizer_TappedAsync" /> 以下逻辑来自链接:https://www.c-sharpcorner.com/article/zoom-in/ double currentScale = 1; double startScale = 1; double xOffset = 0; double yOffset = 0; private void TapGestureRecognizer_TappedAsync(object sender, System.EventArgs e) { var Content = ((FFImageLoading.Forms.CachedImage)sender); double multiplicator = Math.Pow(2, 1.0 / 10.0); startScale = Content.Scale; Content.AnchorX = 0; Content.AnchorY = 0; for (int i = 0; i < 10; i++) { currentScale *= multiplicator; double renderedX = Content.X + xOffset; double deltaX = renderedX / Content.Width; double deltaWidth = Content.Width / (Content.Width * startScale); double originX = (0.5 - deltaX) * deltaWidth; double renderedY = Content.Y + yOffset; double deltaY = renderedY / Content.Height; double deltaHeight = Content.Height / (Content.Height * startScale); double originY = (0.5 - deltaY) * deltaHeight; double targetX = xOffset - (originX * Content.Width) * (currentScale - startScale); double targetY = yOffset - (originY * Content.Height) * (currentScale - startScale); Content.TranslationX = Math.Min(0, Math.Max(targetX, -Content.Width * (currentScale - 1))); Content.TranslationY = Math.Min(0, Math.Max(targetY, -Content.Height * (currentScale - 1))); Content.Scale = currentScale; //await Task.Delay(10); } xOffset = Content.TranslationX; yOffset = Content.TranslationY; }

回答 1 投票 0

在Xamarin.iOS统一API中安装MvvmCross.Core

我创建了一个统一API项目,并根据此安装了组合PCL配置文件+ NuGet 2.8.3 alpha安装程序。 因此,现在我的配置文件 78 现在可以识别 Xamarin.iOS Unified 项目。但是当...

回答 1 投票 0

我需要避免 android-12 API Xamarin 表单中的双闪屏问题

SplashActivity.cs 命名空间 Splash12.Droid { [活动(主题 =“@style/MyTheme.Splash”,MainLauncher = true,NoHistory = true)] 公共类 SplashActivity :AppCompatActivity ...

回答 2 投票 0

如何使用 Xamarin for Visual Studio 在真正的 Android 设备上进行调试?

我找到了一些链接,但它们没有解释这是如何完成的。我可以使用 Xamarin Studio IDE 进行调试,但该 IDE(无意冒犯)与 Visual Studio 2012 相比是蹩脚的。 使用 Visual Studio 2012,有

回答 11 投票 0

如何在 MAUI 应用程序中覆盖父资源字典属性?

我创建了一个类库,它在 ResourceDictionary 对象中定义了一些样式和颜色。这些在多个 MAUI 应用程序的每个 App.xaml 文件中引用,如下所示: 我创建了一个类库,它在 ResourceDictionary 对象中定义了一些样式和颜色。这些在几个 MAUI 应用程序的每个 App.xaml 文件中引用,如下所示: <myParentLibrary:ControlStyles/> <myParentLibrary:Colors/> 现在我的每个应用程序显然都有自己的配色方案和样式,因此它们也像这样包含它们: <ResourceDictionary Source="Resources/Styles/Colors.xaml" /> <ResourceDictionary Source="Resources/Styles/Styles.xaml" /> 需要注意的是,父类库和应用程序中定义的 Color 值的名称是相同的,因为我希望类库提供基色,但最终使用应用程序定义的值。 为了说明这一点,请考虑以下场景: (来自班级图书馆) <Style x:Key="ExampleStyle" TargetType="Label"> <Setter Property="TextColor" Value="{StaticResource Black}"/> </Style> <Color x:Key="Primary">Red</Color> (来自应用程序) <Color x:Key="Primary">Blue</Color> <!-- This is from the Colors.xaml file of app --> <Label Style="{StaticResource ExampleStyle}"/> <!-- This is from a Page in the app --> -> 如何将标签的颜色设置为红色,而不是蓝色?在类似于我在这里描述的场景中这可能吗? 非常感谢您花时间帮助我。 我希望这条消息对您有好处。我写信是为了提供有关您请求的广告制作的最新信息。以下是广告的详细信息,包括 ResourceDictionary 对象中定义的类库、样式和颜色,以及它们在各种 MAUI 应用程序的 App.xaml 文件中的引用:

回答 1 投票 0

如何删除Xamarin中无用的标头块?

我有无用的块,其中输入了“Вісточка”。 我怎样才能删除它? 我只需要“Налаштування”部分。 这是带弹出按钮的外壳。

回答 1 投票 0

如何设置 Xamarin 社区工具包弹出窗口的大小以在 Xamarin Forms 中动态包装内容?

我有一个 Xamarin.CommunityToolkit - 弹出窗口。我不想预先定义它的大小。我希望它根据内容动态调整大小。有什么办法可以实现这一点吗? 这是我的 XAML 代码: 我有一个 Xamarin.CommunityToolkit - Popup。我不想预先定义它的大小。我希望它根据内容动态调整大小。有什么办法可以达到这个目的吗? 这是我的XAML代码: <?xml version="1.0" encoding="UTF-8"?> <xct:Popup xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:xct="http://xamarin.com/schemas/2020/toolkit" x:Class="SampleProject.Views.SamplePopup"> <StackLayout> <Label Text="Hello Xamarin.Forms!" /> <Button Text="Close Popup" Clicked="ClosePopup" /> </StackLayout> </xct:Popup> 当前的实现不支持此类功能,正如 Amjad 在他的评论中提到的那样,过去有一个类似的功能请求,但随着事情迁移到新的 repo .NET MAUI 社区工具包,它被关闭了。 如果您有兴趣,可以打开讨论,解释或指向该功能请求的链接。 由于社区工具包弹出窗口动态自动高度调整问题存在错误报告,您可以考虑通过根据其内容动态设置弹出窗口高度来解决问题。 <xct:Popup xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:xct="http://xamarin.com/schemas/2020/toolkit" x:Class="SampleXamarinForms.SamplePopup" SizeChanged="Popup_SizeChanged" x:Name="myPopup"> <StackLayout x:Name="myStacklayout"> <Label Text="Hello Xamarin.Forms!" /> <Button Text="Close Popup" Clicked="ClosePopup" /> </StackLayout> </xct:Popup> public partial class SamplePopup : Popup { public SamplePopup () { InitializeComponent (); } void Popup_SizeChanged(object sender, EventArgs e) { double width = GetDeviceWidth() - 40; double height = myStacklayout.Height; myPopup.Size = new Size(width, height); } private double GetDeviceWidth() { var mainDisplayInfo = DeviceDisplay.MainDisplayInfo; var width = mainDisplayInfo.Width; return width; } }

回答 2 投票 0

“该项目的目标是 API 级别‘android-33’,未安装”但是,我已经安装了它

我在 Visual Studio 2022 社区中打开了一个新项目,一个基本 Android 应用程序(Android,Gradle)。创建项目后,我在标题中收到警告。 我尝试安装、卸载、重新安装,你...

回答 1 投票 0

Visual Studio for Mac 17.6.3 无法打开故事板

我已将 macOS 更新到版本 13.5.1,将 Visual Studio 更新到版本 17.6.3,将 Xcode 更新到版本 14.3.1。我有一个于 2016 年创建的较旧的 Xamarin.iOS 项目。虽然该项目可以构建,但...

回答 1 投票 0

如何从Imgur获取access_token和refresh_token?

我正在使用的项目:来自 nuget 的 ImgurNet (来源:https://github.com/0xdeafcafe/ImgurNet) 看起来它需要所有这些参数: { "client_id": "在此插入您的图片 client_id", ”

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.