小编Man*_*uel的帖子

在选择Entry Control之前,Xamarin.Forms Switch Control在Android上不可见

我有一个看起来大致相同的注册表

<StackLayout>
    <StackLayout 
        HorizontalOptions="FillAndExpand" 
        Padding="{x:Static local:Styles.LabelBeforeEntryPadding}">
        <Label 
            Text="{Binding LabelPasswort2}" 
            HorizontalOptions="{x:Static local:Styles.LabelHorizontalOptions}" 
            TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
    </StackLayout>
    <custom:StrypeEntry 
        Text="{Binding Passwort2}" 
        IsPassword="true" 
        IsEnabled="{Binding ControlsEnabled}" 
        HorizontalOptions="FillAndExpand" />
</StackLayout>
<!--Newsletter-->
<StackLayout 
    Orientation="Horizontal" 
    HorizontalOptions="StartAndExpand">
    <Switch 
        IsToggled="{Binding Newsletter}" 
        IsEnabled="{Binding ControlsEnabled}" 
        VerticalOptions="StartAndExpand" 
        HorizontalOptions="StartAndExpand"  />
    <Label 
        Text="{Binding LabelNewsletter}" 
        VerticalOptions="CenterAndExpand" 
        HorizontalOptions="Start" 
        TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
</StackLayout>
<!--Datenschutz-->
<StackLayout 
    Orientation="Horizontal" 
    HorizontalOptions="StartAndExpand">
    <custom:StrypeSwitch 
        IsToggled="{Binding Privacy}" 
        IsEnabled="{Binding ControlsEnabled}" 
        VerticalOptions="StartAndExpand" 
        HorizontalOptions="StartAndExpand" />
    <Label 
        Text="{Binding LabelPrivacy}" 
        VerticalOptions="CenterAndExpand" 
        HorizontalOptions="Start" 
        WidthRequest="300" TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
</StackLayout>
Run Code Online (Sandbox Code Playgroud)

问题是,在显示表单时,开关不可见,它们仅在条目聚焦时才可见.

StrypeEntry只是一个带有Border Corder的自定义条目和一个大写的道具,没有任何花哨的东西,而且为了切换我做了一个自定义渲染器来修复不显示的问题.

我已经尝试了ButtonText Alignment的修复程序没有帮助(Xamarin.Forms:点击后错误的按钮文本对齐(Android))

我也尝试过这个

public override void ChildDrawableStateChanged(View child) …
Run Code Online (Sandbox Code Playgroud)

android xamarin.forms

4
推荐指数
1
解决办法
3003
查看次数

标签 统计

android ×1

xamarin.forms ×1