Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

MaterialTextField setting background to Transparent not working

未关闭
#374 8 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
android
领域
mobile-dev

调研方向

使用指定的 Xamarin.Forms 和库版本,在 Android 上通过 MaterialTextField 和 BackgroundColor="Transparent" 重现报告中的 XAML。首先跟踪 MaterialTextField 的 Android 渲染和背景处理;当字段保持透明且该行为由回归测试覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

🐛 Bug Report

When setting the BackgroundColor to Transparent on a MaterialTextField the BackgroundColor is still filled with the default color, ignoring the Transparent property on Android. This is tested with a MaterialTextField inside a Grid with a Background image on Android. The Background image is a <Image> component with a rowspan of the total grid rows, and Aspect set to AspectFill. It is not (yet) tested on iOS.

I also tested it without the background image and it results in the same (the Transparent property being ignored).

Expected behavior

The Filled color should be transparent of the MaterialTextField and not default back to the #DCDCDC value.

Screenshots

image

XAML Code
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="PCS2.APP.Views.Login.LoginPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:customControls="clr-namespace:PCS2.APP.CustomComponents;assembly=PCS2.APP"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Shell.FlyoutBehavior="Disabled"
    Shell.NavBarIsVisible="False"
    Shell.PresentationMode="ModalAnimated"
    Shell.TabBarIsVisible="False"
    mc:Ignorable="d">


    <ContentPage.Content>

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


            <Image
                x:Name="PCSBackground"
                Grid.Row="0"
                Grid.RowSpan="6"
                Aspect="AspectFill" />


            <Image
                x:Name="PCSLogo"
                Grid.Row="1"
                Aspect="AspectFit"
                HeightRequest="70" />


            <material:MaterialTextField
                Grid.Row="2"
                Margin="{StaticResource EntryMargin}"
                AlwaysShowUnderline="True"
                BackgroundColor="Transparent"
                InputType="Email"
                Placeholder="E-mail of gebruikersnaam"
                Text="{Binding Email}" />


            <material:MaterialTextField
                Grid.Row="3"
                Margin="{StaticResource EntryMargin}"
                AlwaysShowUnderline="True"
                BackgroundColor="Transparent"
                InputType="Password"
                Placeholder="Wachtwoord"
                Text="{Binding Password}" />


            <material:MaterialButton
                Grid.Row="4"
                Margin="30,16,30,80"
                BackgroundColor="#3880ff"
                Command="{Binding ExecuteLogin}"
                Text="Inloggen" />


        </Grid>
    </ContentPage.Content>
</ContentPage>
Configuration

Version: 1.7.4

Platform:

  • 📱 iOS
  • 🤖 Android
  • 🏁 WPF
  • 🌎 UWP
  • 🍎 MacOS
  • 📺 tvOS
  • 🐒 Xamarin.Forms
Additional information
  • Using Xamarin.Forms 4.8.0.1364
  • Using Xamarin.Essentials 1.5.3.2
  • Targeting framework: Android 10.0 (API Level 29 - Q)

Additional used libraries:

  • Splat 9.5.37
主要语言
C#
星标
631
派生
150
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Baseflow/XF-Material-Library 的其他 Issue

查看 Baseflow/XF-Material-Library 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。