Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageButton Padding not working when manipulate IsVisible On Android #16713

Open
muak opened this issue Aug 12, 2023 · 6 comments · May be fixed by #25223
Open

ImageButton Padding not working when manipulate IsVisible On Android #16713

muak opened this issue Aug 12, 2023 · 6 comments · May be fixed by #25223
Labels
area-controls-button Button, ImageButton migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@muak
Copy link

muak commented Aug 12, 2023

Description

If IsVisible of the ImageButton or IsVisible of another View on the same level as the ImageButton changes, the Padding of the ImageButton is disabled.

<AbsoluteLayout>        

    <ImageButton
        AbsoluteLayout.LayoutFlags="PositionProportional"
        AbsoluteLayout.LayoutBounds="0.5,0.5,120,120"
        Source="dotnet_bot.png"
        WidthRequest="120"
        HeightRequest="120"
        CornerRadius="60"
        Padding="30"
        Aspect="AspectFit"                
        BackgroundColor="Beige"
        IsVisible="true"
        x:Name="imageButton"/>

    <ContentView
        AbsoluteLayout.LayoutFlags="SizeProportional"
        AbsoluteLayout.LayoutBounds="0,0,1.0,1.0"
        BackgroundColor="#80FFFFFF"
        IsVisible="true"
        x:Name="overlay"
        />
        
</AbsoluteLayout>
    public MainPage()
    {
        InitializeComponent();

        Dispatcher.DispatchDelayed(TimeSpan.FromSeconds(3), () =>
        {
            overlay.IsVisible = false;
            // workaround
            //this.ForceLayout();
        });
    }
Before After

Steps to Reproduce

  1. Arrenge an ImageView and any other View on the same parent layout .
  2. Manipulate IsVisibleProperty of either.
  3. ImageView Padding disabled.

Link to public reproduction project repository

https://github.com/muak/Maui.ImageButtonIssue

Version with bug

8.0.0-preview.7.8842

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms, Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android13

Did you find any workaround?

This can be avoided by calling Page's ForceLayout.

Relevant log output

No response

@muak muak added the t/bug Something isn't working label Aug 12, 2023
@muak muak changed the title ImageButton Padding not working when IsVisible On Android ImageButton Padding not working when manipulate IsVisible On Android Aug 12, 2023
@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Aug 15, 2023
@samhouts samhouts added platform/android 🤖 area/migration 🚚 area-controls-button Button, ImageButton migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert and removed area/migration 🚚 labels Aug 15, 2023
@mattleibow mattleibow added this to the Backlog milestone Aug 16, 2023
@ghost
Copy link

ghost commented Aug 16, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@mattleibow
Copy link
Member

Does this also happen with other layouts? a Grid for example?

@muak
Copy link
Author

muak commented Aug 17, 2023

@mattleibow
Yes, It happens with Gird too.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 23, 2023
@XamlTest
Copy link

XamlTest commented Aug 23, 2023

Verified this on Visual Studio Enterprise 17.8.0 Preview 1.0. Repro on Android 13.0-API33 .NET 8, not repro on Windows 11 ans iOS 16.4 with below Project:
ImageButtonIssue.zip

@BaY1251
Copy link

BaY1251 commented Nov 15, 2023

Verified this on Visual Studio Enterprise 17.9.0 Preview 1.0. MAUI-8.0.3. Repro on Android 14.0-API34.
Also happens when softkeyboard visibility changed

@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@eworker2003
Copy link

I have the same issue with ImageButton after make it visible. I have a workround for me - re-change Paddings:
Button.IsVisible = true;
Button.Padding = new Thickness(4-1, 16, 0, 16); // do some change
Button.Padding = new Thickness(4, 16, 0, 16); // back to desired paddings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-button Button, ImageButton migration-compatibility Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants