繁体   English   中英

.NET MAUI 7 - AbsoluteLayout 中的按钮在 Android 中不起作用

[英].NET MAUI 7 - Button in AbsoluteLayout not working in Android

如下图,我在右下角创建了一个按钮,绝对布局。 问题是,它不适用于 Android。 它出现了,而是按下了下面的食谱。 在 Windows 应用程序上,一切都按预期工作。

在此处输入图像描述

这是代码:

<FlexLayout>
    <RefreshView IsRefreshing="{Binding IsRefreshing}" Command="{Binding RefreshRecipes}">

        <CollectionView >
            ...
        </CollectionView>
    </RefreshView>
    <AbsoluteLayout MaximumWidthRequest="0" >
        <Button AbsoluteLayout.LayoutBounds="1, 1, 100, 100"
                AbsoluteLayout.LayoutFlags="PositionProportional"
                Text="+"
                Command="{Binding AddRecipeCommand}"
                FontSize="Large"
                BackgroundColor="DodgerBlue"
                TextColor="White"
                CornerRadius="25"
                HeightRequest="50"
                WidthRequest="50" 
                ZIndex="100"/>
    </AbsoluteLayout>
</FlexLayout>

我知道MaximumWidthRequest="0"可能会导致问题,但我不知道还能做什么。

将 FlexLayout 更改为网格。 然后删除 AbsoluteLayout 并将 VerticalOptions 和 HorizontalOptions 设置为 End。 我就是这样做的。

如果这不起作用,您必须显示您的 xaml.cs 代码和 ViewModel 代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM