-
Notifications
You must be signed in to change notification settings - Fork 693
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
[NET6][Android] VisibleBoundsPadding and it's API are Not Working #12007
Comments
May be similar to #6218 |
Looks to be some sort of layouting/measuring issue on Android. Attached a small repro app - VisibleBoundsPaddingTest.zip. Some sort of race condition maybe? It seems that the VisibleBoundsPadding is properly setting the Padding on the control but it is not reflected in the UI until a re-layout is forced. In the repro app, either you can:
Expected positions of green boxes: Actual positions of green boxes: Here's what happens when you click on the re-layout button, notice the bottom padding appears after clicking. Also, @Soap-141, I get the same issue on a Xamarin/UWP app so I'm not sure if it's net6.0-android specific: sample app - VBPXamUWP.zip |
@kazo0 Yeah I did not notice any issue on our Xamarin applications as of now but it could also be an issue I guess. As long as we can find a fix. Poke me if you need anything. |
@kazo0 @jeromelaban I guess I should create a backport request for 4.8 after testing? |
@kazo0 Should it be on |
I'm not sure if we'll be able to backport to 4.8, this is quite a large change. |
You can find published builds from this list. |
The build is not ready yet. Will have to test later then. |
@kazo0 @jeromelaban I tested Uno // Workaround for Android 10, the navigation bar is not included in the visible bounds, so we need to add it manually.
if (safeAreaBottomPadding == 0)
{
var navigationBarHeightId = Android.Content.Res.Resources.System.GetIdentifier("navigation_bar_height", "dimen", "android");
var navigationBarHeight = Android.Content.Res.Resources.System.GetDimensionPixelSize(navigationBarHeightId) / Android.Content.Res.Resources.System.DisplayMetrics.Density;
safeAreaBottomPadding += navigationBarHeight;
} |
@Soap-141 sorry the PR was accidentally merged and auto-closed the issue, im still working on it now. It should definitely have fixed the issue you are talking about though for Android 10- so this is concerning. I will look into it |
@kazo0 It's supposed to be API 29. But I'm testing again in a couple of minutes. |
@kazo0 If I set |
I'm not quite sure I'm understanding the issue, you should just be able to use the |
Oh wait, are you saying |
@kazo0 Exactly, for Android 10. |
Strange, it's working for me, I created a button and on click I grab the bottomPadding like you do and I am getting a value. Are you perhaps trying to calculate this too early? What is the value of the VisibleBounds when you debug? |
@kazo0 |
Strange, I am using an API 29 emulator: @Soap-141, what nuget package version are you on? the ones from the pull request i linked? |
@kazo0 Didn't have access to your link, so I assumed latest preview. |
ah i see, ok so this should all be fixed by #12444 |
@Soap-141 you should be able to test with 4.10.0-dev.76 |
@kazo0 Thanks I'll be testing that out and may request a back port on 4.8/4.9 depending on what is possible. |
It's working thanks @kazo0! https://github.com/unoplatform/nventive-private/issues/486 |
Current behavior
Using
Uno.UI.Toolkit.VisibleBoundsPadding.PaddingMask=Bottom
with<item name="android:windowTranslucentNavigation">true</item>
doesn't work and the Android navigation bar height is ignored.Also this wasn't an issue on Xamarin with or without the
windowTranslucentNavigation
.I also noticed that on Android 10,
ApplicationView.GetForCurrentView().VisibleBounds.Bottom
doesn't include the navigation bar height in it and can cause issues with custom controls even if it looks like it work insideUno.UI.Toolkit.VisibleBoundsPadding.PaddingMask=Bottom
. On some applications we need to set<item name="android:windowTranslucentNavigation">true</item>
but not in the sample.Android 13 issue:
Android 10 issue:
Expected behavior
How to reproduce it (as minimally and precisely as possible)
<item name="android:windowTranslucentNavigation"></item>
in Styles.xml.Workaround
Android 13 issue:
Playing around with
<item name="android:windowTranslucentNavigation">false</item>
or<item name="android:windowTranslucentNavigation">true</item>
may fix the issue.Android 10 issue:
Adding some Android 10 specific code could fix the issue but it doesn't look like the right thing to do considering that it assumes that we must have bottom padding here.
Works on UWP/WinUI
None
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
4.9.0-dev.580
Affected platforms
Android
IDE
Visual Studio 2022
IDE version
17.5.4
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: