选中时,所有条目输入均为红色

时间:2018-12-04 19:45:18

标签: xamarin xamarin.forms cross-platform

每当在调试时点击输入组件时,选中的颜色为红色。我没有在任何地方设置它,所以我不明白为什么会这样。 我的资源文件使用的是“ 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>

外观如何  The Result

1 个答案:

答案 0 :(得分:3)

android中的特定颜色表示重音颜色。您可以覆盖android颜色样式来定义该颜色。

@keyframes fade-in {
100% {
    opacity: 1;
    transform: translate(0, 0);
     }
}
#section-grid a:nth-of-type(1) {
    animation: fade-in .2s 0s forwards ease-out;
}

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
      <a href="<?php the_permalink(); ?>">
         <div>
            <img src="<?php the_field('feature_image2'); ?>" alt="plant">
               <aside>
                   <?php the_title(); ?>
               </aside>
         </div>
      </a>

      <?php endwhile; else: ?>
          <div class="page-header">
               <h1>Coming Soon</h1>
          </div>
          <p>If there is nothing here that doesn't mean nothing is coming. Stay tuned for updates and new information.</p>
      <?php endif; ?>

您应该能够在Resources文件夹内的Xamarin Android Specific项目中找到Styles.xml文件。希望这会有所帮助。

注意:这也将更改其他控件的强调颜色。如果您仅想为Entry更改这种颜色。您必须为此编写Custom Renderer。让我知道您是否想那样做。