MaterialTextField setting background to Transparent not working
还没有人认领这个 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

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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Baseflow/XF-Material-Library 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
Baseflow/XF-Material-Library#458 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 50/100
Baseflow/XF-Material-Library#457 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 48/100
Baseflow/XF-Material-Library#456 ·
-
难度 3/5 1-2 天 新手友好度 35/100
Baseflow/XF-Material-Library#454 ·
-
难度 1/5 1 小时以内 新手友好度 58/100
Baseflow/XF-Material-Library#453 ·
查看 Baseflow/XF-Material-Library 的全部 Issue
相似的 Issue
-
WPF: each page's `Title` overwrites the window title, and returning to a page does not restore it未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
agentic-workflows area/Docs partner/agentic-workflows
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
jamesmontemagno/tiny-clips#378 · 2 条评论 ·
维护者通常 1 天内回复
-
go 🏃 testing 🧪
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7239 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15462 ·
维护者通常 1 天内回复