I want the height of the NavigationBar, tried using CustomRenderer but always gets the same value whether it is Tablet, Android phone.
I am using the following code
namespace OfflineFieldService.Droid
{
public class CustomAndroidPageRenderer : PageRenderer
{
public CustomAndroidPageRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
var height = 0;
var resources = Context.Resources;
int resourceId = resources.GetIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0)
{
height = resources.GetDimensionPixelSize(resourceId);
}
var scale = Resources.DisplayMetrics.Density;
var heightinUnits = (height - .5) / scale;
App.screenHeight = heightinUnits;
}
}```
[Attached image in the link, since dont have permission to embed][1]
[1]: https://i.stack.imgur.com/UosCb.png
In the image whatever marked in yellow, need to get the height of it. I am using Shell template.
Navigation Bar Height iOS
Nav Bar height android
Screen Size Android
Screen Size iOS