dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.04k stars 1.73k forks source link

Android project ToolbarItem font color exception after changing available state #22937

Closed pksniq closed 1 month ago

pksniq commented 3 months ago

Original Title: Android项目ToolbarItem改变可用状态后字体颜色异常

Description

Android project in the background code after setting IsEnabled, the font color becomes white, and then no matter how to set IsEnabled font color is white.

Original Text: Android项目在后台代码设置IsEnabled后,字体颜色变成白色,然后无论怎么设置IsEnabled字体颜色都是白色

Steps to Reproduce

private void bQuery_Clicked(object sender, EventArgs e) { bTest.IsEnabled = !bTest.IsEnabled; }

Link to public reproduction project repository

No response

Version with bug

8.0.40 SR5

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.40 SR5

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

No response

Relevant log output

No response

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

pksniq commented 3 months ago

QQ截图20240610210927

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="ToolBarBug.MainPage">
    <ContentPage.ToolbarItems>
        <ToolbarItem x:Name="bOk" Text="Ok" Clicked="bOk_Clicked"></ToolbarItem>
        <ToolbarItem x:Name="bBug" Text="Bug"></ToolbarItem>
    </ContentPage.ToolbarItems>
    <ScrollView>
        <VerticalStackLayout
            Padding="30,0"
            Spacing="25">

            <Label
                Text="When click Ok,Bug font color error on Android 11"
                Style="{StaticResource Headline}"
                SemanticProperties.HeadingLevel="Level1" />

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>
namespace ToolBarBug
{
    public partial class MainPage : ContentPage
    {
        int count = 0;

        public MainPage()
        {
            InitializeComponent();
        }

        private void bOk_Clicked(object sender, EventArgs e)
        {
            bBug.IsEnabled = !bBug.IsEnabled;
        }
    }

}
pksniq commented 3 months ago

image

pksniq commented 3 months ago

No matter how you click the Ok button, the bug button font is always white

pksniq commented 3 months ago

ToolBarBug.zip No matter how you click the toolbaritem Ok button, the toolbaritem bug button font is always white,IsEnabled's bug,This bug only appears when modifying IsEnabled in the code, and setting it directly in XAML will not be a problem. Android 14 is also have this bug. Has anyone managed the Maui team now? I have found that this bug has been present since 8.0.3. If you abandon this project, please develop a better alternative. I dare not use Microsoft's technology anymore

kevinxufei commented 3 months ago

Verified this issue with Visual Studio 17.11.0 Preview 2.0 (8.0.40 & 8.0.3). Can repro this issue with sample project. ToolBarBug.zip