Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] Android button's text in Popup not aligned to center

Open czmirek opened this issue 5 months ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

  • [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

Current Behavior

Button text is not centered when inside a popup in the reproduction repository here: https://github.com/czmirek/MauiButtonAlignBug

Expected Behavior

The button text is aligned to center correctly.

Steps To Reproduce

  • https://github.com/czmirek/MauiButtonAlignBug
  • Run in debug in Android Simulator --- Android 12.1, API 32
  • Click on "Show popup"
image
  • Observe button text not centered
image

Link to public reproduction project repository

https://github.com/czmirek/MauiButtonAlignBug

Environment

- .NET MAUI CommunityToolkit: 7.0.1
- .NET MAUI: 8.0.7
- OS: Android 12.1, API 32
- Happens in both Debug and Release

Anything else?

  • Go to TestPopup.xaml and remove the style from the <Button>
  • It is centered now image

But as you can see in App.xaml there is nothing in the styles that should affect how the text inside the button is aligned.

        <ResourceDictionary>
            <Color x:Key="PrimaryColor">#FFBB00</Color>
            <Color x:Key="TextColor">#000000</Color>
            <Style TargetType="Button" x:Key="BaseButton">
                <Setter Property="CornerRadius" Value="{OnPlatform 25}" />
                <Setter Property="Padding" Value="20,10,20,10" />
                <Setter Property="FontSize" Value="16" />
                <Setter Property="HeightRequest" Value="48" />
            </Style>
            <Style TargetType="Button" x:Key="PrimaryButton" BasedOn="{StaticResource BaseButton}">
                <Setter Property="BackgroundColor" Value="{StaticResource PrimaryColor}" />
                <Setter Property="TextColor" Value="{StaticResource TextColor}" />
            </Style>
        </ResourceDictionary>

czmirek avatar Feb 28 '24 15:02 czmirek