选中时所有输入输入均为红色

All Entry inputs are red when selected

每当我在调试时点击入口组件时,选择时的颜色为红色。我没有在任何地方设置它,所以我不明白为什么会这样。 我的资源文件中有 "TextColor"

的颜色
    <Color x:Key="TextColor">#FFFFFF</Color>

我的 Xaml 页面:

<?xml version="1.0" encoding="utf-8" ?>
 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="MyApp.Views.RegisterPage"
                      BackgroundColor="{StaticResource PrimaryColor}">
<ContentPage.Content>

    <FlexLayout Direction="Column" Margin="30" 
            JustifyContent="Center" >
        <StackLayout Margin ="0,0,0,15">
            <Entry  PlaceholderColor="{StaticResource TextColor}" TextColor="{StaticResource TextColor}" Placeholder="First Name"/>
            <Entry PlaceholderColor="{StaticResource TextColor}" TextColor="{StaticResource TextColor}" Placeholder="Last Name "  />
            <Entry PlaceholderColor="{StaticResource TextColor}" TextColor="{StaticResource TextColor}" Placeholder="E-Mail " />
            <Entry PlaceholderColor="{StaticResource TextColor}" TextColor="{StaticResource TextColor}" Placeholder="Password" />
            <Entry PlaceholderColor="{StaticResource TextColor}" TextColor="{StaticResource TextColor}" Placeholder="Retype Password" />
        </StackLayout>
        <StackLayout Margin ="0,30,0,0">
            <Button TextColor="{StaticResource TextColor}" BackgroundColor="{StaticResource AccentColor}" Padding="20" Text="Register"/>

        </StackLayout>

    </FlexLayout>
</ContentPage.Content>

外观如何

android 中的特定颜色代表强调色。您可以覆盖 android 强调色样式来定义该颜色。

<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
   <item name="colorPrimary">@color/primary</item>
   <item name="colorPrimaryDark">@color/primaryDark</item>
   <item name="colorAccent">#your-color-here </item>
</style>

</resources>

您应该能够在资源文件夹中的 Xamarin Android 特定项目中找到 Styles.xml 文件。希望这有帮助。

注意 :这也会更改其他控件的强调色。如果您只想为 Entry 更改此类颜色。您必须为此编写自定义渲染器。如果你想走那条路,请告诉我。