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

[Bug] Resources.System.DisplayMetrics.HeightPixels return the false height when with the notch display [Xamarin.Forms.Android]] #7085

Open
BalasubramaniSundaram opened this issue Aug 7, 2019 · 8 comments
Labels
p/Android partner Issue submitted by partner or related open source project s/unverified New report that has yet to be verified t/bug 🐛

Comments

@BalasubramaniSundaram
Copy link

BalasubramaniSundaram commented Aug 7, 2019

Description

Hi Team,

We at Syncfusion develop data virtualization controls for Xamarin and we have more than 90 controls spread across all platforms of Xamarin. Please refer the below link for a description about us.
UserGuide: https://help.syncfusion.com/xamarin/sfdatagrid/overview
FeatureTour: https://www.syncfusion.com/products/xamarin
UserGuide:https://help.syncfusion.com/xamarin/sflistview/getting-started

Issue

We have recently encountered an issue in Xamarin.Forms.Android, when we are taking the "Resources.System.DisplayMetrics.HeightPixels" its difference in height pixel with the device of notch display and normal display. we are trying to displaying the popup for full screen in both the with and without notch display, we are doing calculated by minus the status bar height from the value of Resources.System.DisplayMetrics.HeightPixels its working fine for the Samsung S8 device and S7 etc, when we come to a device like One plus, One Plus 7 with notch display its return the value was didn't consider the status bar and return the height for the below notch display space.

Note :
Permanently hide the navigation bar in the device.

Steps to Reproduce

  1. Run the attached sample.
  2. In the appearing Method, we have printed the value for of display height from the " "Resources.System.DisplayMetrics.HeightPixels""
  3. Check-in Samsung S8 device and One plus 6

Expected Behavior

Resources.System.DisplayMetrics.HeightPixels should return the whole height of the screen whether its notch display or normal display

Actual Behavior

Resources.System.DisplayMetrics.HeightPixels didn't consider the status bar height in notch display.

Basic Information

  • Version with issue: No
  • Last known good version: No
  • IDE: Visual Studio 2019
  • Platform Target Frameworks:
    • Android: API 9.0 Pie
  • NuGet Packages: Xamarin.Forms 4.1
  • Affected Devices: One plus 6, One plus 7, Hawaii P lite 10

Screenshots

Samsung device
image

One Plus 6
image

Reproduction Link

Sample Popup_Demo.zip

@BalasubramaniSundaram BalasubramaniSundaram added s/unverified New report that has yet to be verified t/bug 🐛 labels Aug 7, 2019
@BalasubramaniSundaram BalasubramaniSundaram changed the title [Bug] Resources.System.DisplayMetrics.HeightPixels return the false height with the notch display [Xamarin.Forms.Android]] [Bug] Resources.System.DisplayMetrics.HeightPixels return the false height when with the notch display [Xamarin.Forms.Android]] Aug 7, 2019
@jfversluis jfversluis added p/Android partner Issue submitted by partner or related open source project labels Aug 7, 2019
@jfversluis
Copy link
Member

Hi @BalasubramaniSundaram !

Thanks for the issue. However, I don't think this is a Xamarin.Forms issue. Google has only provided notch (or display cutout as they call it) API's for Android 9 and above. On those devices you should be able to configure some layout settings and/or retrieve the notch height, etc. that you can use to determine the right height.

Some more information can be found here: https://developer.android.com/guide/topics/display-cutout

@BalasubramaniSundaram
Copy link
Author

Hi @jfversluis,
Thanks, We have already done all the calculation for the notch as well the navigation bar bottom cases, this issue is peculiar in few devices only. Same as Hawaii P 9 with notch display is working fine from our side when coming to Oneplus, Hawaii P10 lite we get the null as well some time faulty value-form "Resources.System.DisplayMetrics" at initial appearing. However, the notch has introduced by android, but the from the API "Resources.System.DisplayMetrics" we are getting inconsistent value.

@KarthikRaja26
Copy link

any update on this ?

@KarthikRaja26
Copy link

Hi @samhouts,

Any update on this ?

@samhouts samhouts reopened this Aug 10, 2020
@KarthikRaja26
Copy link

Hi @samhouts ,

Any update on this ?

@pradeepkumar417
Copy link

Hi @samhouts

Any update on this?

@KarthikRaja26
Copy link

Hi @samhouts

Any update on this ?

@SujaVenkatesan
Copy link

Hi @samhouts

Any update on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p/Android partner Issue submitted by partner or related open source project s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

6 participants