You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET MAUI Android端SwipeView文本截断问题求助

.NET MAUI Android端SwipeView项内文本被截断问题

在Android端运行.NET MAUI应用时,遇到SwipeView项内文本被截断的问题,几个小时前该功能还能正常工作。查阅官方文档后发现,SwipeView除Text属性外,没有其他与文本相关的配置属性。

问题截图:
SwipeView文本被截断

对应的XAML代码如下:

<ContentPage.Resources>
    <Style TargetType="Label">
        <Setter Property="BackgroundColor" Value="Transparent" />
        <Setter Property="TextColor" Value="Black" />
    </Style>

    <Style TargetType="SwipeView">
        <Setter Property="VisualStateManager.VisualStateGroups">
            <VisualStateGroupList>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <VisualState.Setters>
                            <Setter Property="BackgroundColor" Value="DarkSeaGreen" />
                        </VisualState.Setters>
                    </VisualState>

                    <VisualState x:Name="Selected">
                        <VisualState.Setters>
                            <Setter Property="BackgroundColor" Value="#508350" />
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateGroupList>
        </Setter>
    </Style>
</ContentPage.Resources>


<Page.Behaviors>
    <mct:StatusBarBehavior
        StatusBarColor="Beige"
        StatusBarStyle="DarkContent" />
</Page.Behaviors>

    <CollectionView ItemsSource="{Binding Transactions}"
                    SelectionMode="Single"
                    >
        <CollectionView.EmptyView>
            <StackLayout Padding="50">
                <Label TextColor="White"
                       FontAttributes="Bold"
                       HorizontalOptions="CenterAndExpand"
                       Text="NO DATA"
                       VerticalOptions="CenterAndExpand" />
            </StackLayout>
        </CollectionView.EmptyView>

    <CollectionView.ItemsLayout>
        <LinearItemsLayout Orientation="Vertical" />
    </CollectionView.ItemsLayout>

    <CollectionView.ItemTemplate>
        <DataTemplate x:DataType="model:BudgetDisplay">
            <SwipeView>
                <SwipeView.LeftItems>
                    <SwipeItems Mode="Reveal">
                        <SwipeItem BackgroundColor="LightPink" Text="Delete" />
                    </SwipeItems>
                </SwipeView.LeftItems>
                <Grid Margin="5,3,5,3" Padding="0,5,0,0" ColumnDefinitions="10,*,*,*,*,100" RowDefinitions="*,*" BackgroundColor="#CFE2CF">
                    <Label Grid.ColumnSpan="6" Grid.Column="0" Grid.Row="0" Text="{Binding Date, StringFormat='{0:d}'}"/>
                    <Label Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1" Text="{Binding Payee}" HorizontalTextAlignment="Start"/>
                    <Label Grid.Column="3" Grid.Row="1" Text="{Binding Amount, StringFormat='{0:c}'}" HorizontalTextAlignment="End"/>
                    <Label Grid.Column="4" Grid.Row="1" Text="{Binding LineBalance, StringFormat='{0:c}'}" HorizontalTextAlignment="End"/>
                    <Label Grid.Column="5" Grid.Row="1" Text="{Binding Catagory}" HorizontalTextAlignment="Center"/>
                </Grid>
            </SwipeView>
        </DataTemplate>
    </CollectionView.ItemTemplate>
        
</CollectionView>

内容的提问来源于stack exchange,提问作者XJonOneX

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 10:20:34