Xamarin网格布局的问题

epfja78i  于 2023-03-16  发布在  其他
关注(0)|答案(1)|浏览(162)
<Grid
                                Margin="30,30,30,30"
                                BackgroundColor="{StaticResource ColorBack002}"
                                RowSpacing="40">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="3*" />
                                    <ColumnDefinition Width="7*" />
                                </Grid.ColumnDefinitions>

                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition Height="Auto" />
                                </Grid.RowDefinitions>


                                <!--#region Method Name-->
                                <Label x:Name="xTxtMethod"
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    Style="{StaticResource LabelStyle}"
                                    Text="Name" />

                                <Ctrl:CtrlTextEdit x:Name="xEditMethodname"
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    BoxHeight="70"
                                    Margin="0,0,15,0"
                                    HorizontalOptions="FillAndExpand"
                                    Style="{StaticResource TextEditStyle}"
                                    Text="{Binding MethodName}" />
                                <!--#endregion-->

我有一个这样的布局。我把文本编辑的水平选项设置为填充和扩展。在屏幕上,文本编辑的尖端被切掉了大约1个像素。为什么会发生这种情况?
Textedit似乎扩大了以适应屏幕,但它似乎已经扩大超过了这一点。
enter image description here

y53ybaqx

y53ybaqx1#

<Ctrl:CtrlScrollView x:Name="xScroll" BackgroundColor="{StaticResource ColorBack002}">

                    <Grid
                        Margin="30,30,30,30"
                        BackgroundColor="{StaticResource ColorBack002}"
                        HorizontalOptions="FillAndExpand"
                        RowSpacing="40"
                        VerticalOptions="FillAndExpand">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="3*" />
                            <ColumnDefinition Width="7*" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>



                        <!--#region Method Name-->
                        <Label x:Name="xTxtMethod"
                            Grid.Row="0"
                            Grid.Column="0"
                            Style="{StaticResource LabelStyle}"
                            Text="Name" />

                        <Ctrl:CtrlTextEdit x:Name="xEditMethodname"
                            Grid.Row="0"
                            Grid.Column="1"
                            Margin="0,0,1,0"
                            BoxHeight="70"
                            HorizontalOptions="FillAndExpand"
                            Style="{StaticResource TextEditStyle}"
                            Text="{Binding MethodName}" />
                        <!--#endregion-->



                        <!--#region Cell Type-->
                        <Label
                            Grid.Row="1"
                            Grid.Column="0"
                            Style="{StaticResource LabelStyle}"
                            Text="Cell Type">
                            <Label.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding CellTypeClick}" />
                            </Label.GestureRecognizers>
                        </Label>

                        <Ctrl:CtrlTextBox x:Name="xEditCellType"
                            Grid.Row="1"
                            Grid.Column="1"
                            Margin="0,0,1,0"
                            HeightRequest="70"
                            HorizontalOptions="FillAndExpand"
                            TextPadding="10,0,0,0">
                            <Ctrl:CtrlTextBox.GestureRecognizers>
                                <TapGestureRecognizer Tapped="BtnCellTypeClick" />
                            </Ctrl:CtrlTextBox.GestureRecognizers>
                        </Ctrl:CtrlTextBox>
                        <!--#endregion-->

我将边距值设为1,使其暂时可见。

相关问题