Xamarin表格获得字体尺寸设置

发布于 2025-02-12 08:03:09 字数 402 浏览 1 评论 0原文

我可以在我的Xamarin项目中获得此字体尺寸设置吗?我喜欢为Android设置此RowHeight值。

xaml

<Grid.RowDefinitions>
    <RowDefinition Height="{Binding RowHeight}"></RowDefinition>
</Grid.RowDefinitions>

Can I get this font size setting in my main Xamarin project. I like to set this RowHeight value for just the Android's.

xaml

<Grid.RowDefinitions>
    <RowDefinition Height="{Binding RowHeight}"></RowDefinition>
</Grid.RowDefinitions>

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡看悲欢离合 2025-02-19 08:03:09

因此,您可以使用该

Device.GetNamedSize 

方法来考虑平台变化,该方法需要命名尺寸来指定字体大小,然后使用可以标记的类型或其他可以处理的视图。因此,如果您想以中等大小的标签为基础,请运行:

RowHeight = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) 
+ (consider adding some padding to account for margin etc here);

https://learn.microsoft.com/en-us/dotnet/api/xamarin.forms.nemedsize?view=xamarin-forms

So you can, you need to account for the platform variations by using the

Device.GetNamedSize 

method, which takes a NamedSize enum to designate the font size, and then the type which could be label, or other view that could be handled. So if you want to base this off of a label with medium size, run:

RowHeight = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) 
+ (consider adding some padding to account for margin etc here);

https://learn.microsoft.com/en-us/dotnet/api/Xamarin.Forms.NamedSize?view=xamarin-forms

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文