gpt4 book ai didi

XAMARIN 表单 - 为什么相同的表单在 iOS 和 Android 上看起来不同

转载 作者:行者123 更新时间:2023-12-02 10:03:51 25 4
gpt4 key购买 nike

我决定尝试 Xamarin Forms,因为我认为我可以为所有平台或至少 Android 和 iOS 进行一种设计。然而,一个简单的形式,例如:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:app91="clr-namespace:App9;assembly=MasterDetail.Android"
x:Class="MasterDetail.CompetitorsListPage"
>
<StackLayout>
<Label Text="{Binding CurrentEvent.Name}"></Label>
<StackLayout Orientation="Horizontal">
<Button Text="By Place" Clicked="Button_OnClickedByPlace"></Button>
<Button Text="By Number" Clicked="Button_OnClickedByNumber"></Button>
<Button Text="By Rating" Clicked="Button_OnClickedByRating"></Button>
<Button Text="Change Event" Clicked="Button_OnClickedChangeEvent"></Button>
</StackLayout>
<ScrollView>
<ListView x:Name="couples" ItemSelected="Comps_OnItemSelected" ItemTapped="Couples_OnItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Round}"></Label>
<Label Text="{Binding Pos, StringFormat='({0}).'}"></Label>
<Label Text="{Binding Name}"></Label>
<Label Text="{Binding StartingNumber}" ></Label>
<Label Text="{Binding OldRating, StringFormat=' [{0}]'}"></Label>
<!--<Label Text="{Binding NewRating, StringFormat=' {0} ]'}"></Label>-->
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollView>
</StackLayout>
</ContentPage>

在 Android 和 iOS 上看起来完全不同。我不介意颜色,但字体大小?我没有在代码或 xaml 中的任何位置设置字体。知道我做错了什么吗?这是显示两个版本的图片: enter image description here

最佳答案

这是设计使然。 Forms 旨在通过使用各自的 UI 标准在每个平台上提供 native 体验。 Android 的默认配色方案与 iOS 不同。 iOS 默认按钮看起来与 Android 不同。

如果您愿意,您可以覆盖默认字体、大小、颜色等,以提供更一致的 UI。 Xamarin还推出了Themes用于帮助您在平台之间提供一致的 UI 的表单。

关于XAMARIN 表单 - 为什么相同的表单在 iOS 和 Android 上看起来不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37402410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com