英文:
Reduce outer space for Entry in Android
问题
我在一个.NET MAUI应用程序中使用了一个包含3个不同行的网格。行高度已经设置好。
当查看行高度时,我无法将其减小,因为它已经变得太小了(可以在顶部的选择颜色上看到)。
但是,我可以看到输入框下方和顶部(我会说是外部)的空间可以减小。
在iOS上,这并不那么困扰,但在Android上目前确实有问题。
我该如何做呢?
英文:
I use a Grid with 3 different Rows in a .NET MAUI App. The RowHeight is already set.
When looking at the RowHeight, I can't reduce the size as is getting already too small then (as can be seen at the selection color on the top).
But, what I can see is that the space below the line of an Entry and at the top (I would say outer) could be reduced.
On iOS it does not bother that much, but in Android currently yes.
How can I do this?
答案1
得分: 1
你应该更改边距设置。您可以将其设置为1-5左右,这样它就会更窄。
边距="2"
英文:
You should change margin settings. You can set it around 1-5 and it will be thinner.
Margin="2"
答案2
得分: 1
以下是您要翻译的内容:
这是对Mert Altiparmak答案的补充。
您可以使用Margin属性通过将其设置为负数来减小外部空间,例如Margin="-2"
。如果值为正数,它将增加外部空间。
此外,Margin可以传递四个参数,如Margin="left, top, right, bottom"
。您可以将其中之一设置为负数以减少一侧的空间。
而您说:
> 在iOS上并不会太影响,但在Android上目前是的。
所以您可以使用XAML中的平台差异 ,例如:
<Entry.Margin>
<OnPlatform x:TypeArguments="Thickness" Default="0">
<On Platform="Android" Value="-2,-2,-2,-2" />
</OnPlatform>
</Entry.Margin>
==== 附加内容 ====
也许还可以使用这样的样式吗?
<Style TargetType="Entry">
...
<Setter Property="Margin" Value="{OnPlatform 0, iOS='0, 0, 0, 0', Android='0, -2, 0, -2'}" />
</Style>
英文:
Here is a suppleme to Mert Altiparmak's answer.
You can use the Margin property to reduce the outer space by setting it as a negative. Such as Margin="-2"
. If the value is positive number, it will increase the outer space.
In addition, the Margin can be passed four parameters such as Margin = "left, top, right, bottom"
. You can set one of then as a negative to reduce one side space.
And you said
> On iOS it does not bother that much, but in Android currently yes.
So you can use Platform differences in the xaml such as:
<Entry.Margin>
<OnPlatform x:TypeArguments="Thickness" Default="0">
<On Platform="Android" Value="-2,-2,-2,-2" />
</OnPlatform>
</Entry.Margin>
==== Additional ====
Maybe also possible with this a Style like this?
<Style TargetType="Entry">
...
<Setter Property="Margin" Value="{OnPlatform 0, iOS='0, 0, 0, 0', Android='0, -2, 0, -2'}" />
</Style>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论