如何在 iOS 中的 Xamarin 按钮上将图像左对齐并将文本对齐到中心?

问题描述

我想将文本居中对齐,但图像在左侧。我已经尝试过使用 Horizo​​ntalAlignment,但它同时对齐了两者。怎么做?

解决方法

尝试使用 ButtonContentLayout.ImagePosition 属性:

https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.button.buttoncontentlayout.imageposition?view=xamarin-forms

,

你知道我如何从 ButtonRenderer 中的 Control 设置它吗?

您可以更改渲染器中按钮的 try: guild = ctx.guild if not guild.has_role(name="Muted"): await guild.create_role(name="Muted") except Exception as e: print(e) await ctx.send("something went wrong") ImageEdgeInsets 以更改图像和标题位置:

TitleEdgeInsets