Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] Can't Overlap a Button with any view under certain circumstances #10067

Open
WarBorg opened this issue Mar 24, 2020 · 2 comments
Open

[Bug] Can't Overlap a Button with any view under certain circumstances #10067

WarBorg opened this issue Mar 24, 2020 · 2 comments

Comments

@WarBorg
Copy link

WarBorg commented Mar 24, 2020

Description

Having the button and another view in front of the button on a layout (AbsoluteLayout, Grid,.. "kind of layout that allows overlap") and all of that into a ScrollView and into a NavigationPage the button will always be on top

There is also a related issue with this, having the button on a layout (AbsoluteLayout, Grid,.. "kind of layout that allows overlap") with something in front of it without the navigation page and the scrollview it will look ok but when I click the button multiple times it will come in front of the other visual elements but even if it looks like it came in front visually, the zone where the element was overlapping is not clickable on the button

If the button is disabled the visual overlap is not happening

related to #3543

Steps to Reproduce

  1. Add a button on a layout (AbsoluteLayout, Grid,.. "kind of layout that allows overlap")
  2. Then add another view (ActivityIndicator, Image, Notification Badges, text, ..) on the layout
  3. Enclose this into a scroll view
  4. Enclose the page into a NavigationPage
  5. The Button always in front if enabled

Expected Behavior

The expected hierarchy of the visual stack would be:

  • Button would be on the back of the visual stack.
  • The other view would be on the front of the visual stack.

Actual Behavior

The button is stuck on the front of the visual stack.

Basic Information

  • Xamarin Forms Version: 4.5.0.396
  • Platform Target Frameworks: Android
    • Android Target SDK: 10.0
    • Android test device: emulator running Android 9 api 28

Screenshots

Screenshot 2020-03-24 at 12 08 30

Reproduction Link

https://github.com/WarBorg/TestActivityButtonXamForms

Workaround

switch to UseLegacyRenderers

@WarBorg WarBorg added s/unverified New report that has yet to be verified t/bug 🐛 labels Mar 24, 2020
@pauldipietro pauldipietro added this to New in Triage Mar 24, 2020
@PureWeen
Copy link
Contributor

@WarBorg this one is a bit tricky and we still don't have the best solution for it..
#7300

The problem here is that button has an elevation on it. When button was using a legacy renderer it was wrapped in a viewgroup with an elevation that just stayed zero so it was always at the same relative elevation as everything else.

A few ways you can fix this without revertting

  • set the layouts to CompressedLayout.IsHeadless="True" which will allow some work around code we have on android to fix what elevations it can
  • wrap the button in a stacklayout or a grid so that it basically simulates having a viewgroup

@WarBorg
Copy link
Author

WarBorg commented Mar 26, 2020

@PureWeen thank you for your answer

since we cant use the CompressedLayout.IsHeadless="True" because we are changing visibility and backgroundcolor on the elements inside the layouts I choose to use the second method and wrapped the button in a stacklayout and seems that did the trick :D

@PureWeen PureWeen added the e/5 🕔 5 label Mar 27, 2020
@PureWeen PureWeen moved this from New to Ready For Work in Triage Mar 27, 2020
@PureWeen PureWeen added p/Android and removed s/unverified New report that has yet to be verified labels Mar 27, 2020
@samhouts samhouts removed this from Ready For Work in Triage Mar 31, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

3 participants