c# – Xamarin表单IOS“Entry”是不可编辑的
发布时间:2020-12-15 22:45:10 所属栏目:百科 来源:网络整理
导读:我正在使用Xamarin.Forms来构建我的应用程序.在登录页面中,我有以下布局 ScrollView Grid RowSpacing="{StaticResource MediumSpacing}" ColumnSpacing="{StaticResource MediumSpacing}" Grid.RowDefinitions RowDefinition Height="Auto"/ RowDefinition H
我正在使用Xamarin.Forms来构建我的应用程序.在登录页面中,我有以下布局
<ScrollView> <Grid RowSpacing="{StaticResource MediumSpacing}" ColumnSpacing="{StaticResource MediumSpacing}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--Two stackLayouts--> <!--StackLayout 1--> <StackLayout Spacing="0" Padding="0"> <!--Three stacklouts here--> <!--First--> <StackLayout> <StackLayout.Spacing> <OnPlatform x:TypeArguments="x:Double" Android="12" iOS="30" WinPhone="12"/> </StackLayout.Spacing> <StackLayout.Padding> <OnPlatform x:TypeArguments="Thickness" Android="32,24,32,24" iOS="16,16,24" WinPhone="32,24"/> </StackLayout.Padding> <imagecircle:CircleImage HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="95" HeightRequest="95" BorderColor="{StaticResource Primary}" Aspect="AspectFill" x:Name="CircleImageAvatar"/> <Label HorizontalTextAlignment="Center" HorizontalOptions="FillAndExpand" StyleId="LoginPageIdentifier" LineBreakMode="WordWrap" FontSize="Large" TextColor="{DynamicResource DetailTextColor}" Text="Single Sign On"> <Label.FontSize> <OnPlatform x:TypeArguments="x:Double" Android="15" iOS="15" WinPhone="15"/> </Label.FontSize> </Label> </StackLayout> <!--Second Stack Layout--> <StackLayout> <StackLayout.Padding> <OnPlatform x:TypeArguments="Thickness" Android="32,0" iOS="32,0" WinPhone="32,0"/> </StackLayout.Padding> <StackLayout.Spacing> <OnPlatform x:TypeArguments="x:Double" Android="0" iOS="15" WinPhone="10"/> </StackLayout.Spacing> <toolkit:EntryLine Text="{Binding Email}" Keyboard="Email" HorizontalOptions="FillAndExpand" Placeholder="Email Address" x:Name="EntryEmail" StyleId="EmailTextField" BorderColor="#ECECEC"> <toolkit:EntryLine.HorizontalTextAlignment> <OnPlatform x:TypeArguments="TextAlignment" iOS="Center"/> </toolkit:EntryLine.HorizontalTextAlignment> </toolkit:EntryLine> <toolkit:EntryLine Text="{Binding NamespaceUri}" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" Placeholder="Namespace" StyleId="EmailTextField" Keyboard="Text" BorderColor="#ECECEC"> <toolkit:EntryLine.HorizontalTextAlignment> <OnPlatform x:TypeArguments="TextAlignment" iOS="Center"/> </toolkit:EntryLine.HorizontalTextAlignment> </toolkit:EntryLine> </StackLayout> <!--Third Stack Layout--> <StackLayout> <StackLayout.Padding> <OnPlatform x:TypeArguments="Thickness" Android="32,25,0"/> </StackLayout.Padding> <StackLayout.Spacing> <OnPlatform x:TypeArguments="x:Double" Android="0" iOS="16" WinPhone="10"/> </StackLayout.Spacing> <Button Text="Sign In" Command="{Binding LoginCommandSso}" HorizontalOptions="FillAndExpand" StyleId="SignInButton" TextColor="White" BackgroundColor="{StaticResource Primary}"> <Button.FontAttributes> <OnPlatform x:TypeArguments="FontAttributes" iOS="Bold"/> </Button.FontAttributes> </Button> </StackLayout> </StackLayout> <!--StackLayout 2--> <!--Contains activity indicator and Corresponding label--> <AbsoluteLayout> <StackLayout Grid.Row="1" Padding="16,0" VerticalOptions="Center" Orientation="Horizontal" HorizontalOptions="Center" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1" IsVisible="{Binding IsBusy}"> <ActivityIndicator IsRunning="{Binding IsBusy}"> <ActivityIndicator.Color> <OnPlatform x:TypeArguments="Color" Android="{StaticResource Primary}"/> </ActivityIndicator.Color> </ActivityIndicator> <Label Text="{Binding Message}" VerticalOptions="Center" HorizontalOptions="Center" /> </StackLayout> </AbsoluteLayout> <!--Stack Layout 3--> </Grid> </ScrollView> 在Android模拟器上运行时,我可以在“EntryLine”中输入文本,一切似乎都能正常工作. 编辑1 – 添加了完整的堆栈布局. 使用 – > Visual Studio 2017,Windows 10,Xamarin – 2.3.4.247 解决方法
你的< AbsoluteLayout>重叠您的内容并捕获所有输入事件.您必须尝试将其IsVisible属性设置为false(或尝试使用InputTransparent属性).至少只要活动指标没有运行.
(如果这不起作用,您可能会尝试使用效果(或自定义渲染器)来处理它,特别是在iOS上设置输入透明度) (您可能还会考虑不将其放在滚动视图中,因为它最终会被滚动掉) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |