How can I know programmatically if a device has a navigation bar and if it has it how can i get the size (width and height).
I tried this solution stackoverflow.com/a/29938139/1683141 and when I test a Sony Xperia Z on Genimotion, returns that not has a navigation bar but it has!
Please I need to fix this cases with navigation bar, because the app not looks good.
Thanks
Try this answer to the question you linked. The difference between appUsableSize and realScreenSize is the space occupied by the navigation bar. (This works because, somewhat unexpectedly, the status bar counts toward appUsableSize.) If both sizes are the same, you have no navigation bar.
Related
I'm currently facing some problems on detection navigation bar on Android Pie (Note 9 device) whether it's VISIBLE or NOT VISIBLE. I have tried many many solutions on the internet such as: KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) or KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME). Even the resources.getIdentifier("config_showNavigationBar", "bool", "android") could not bring the result as i want. I just want to ask if there is any ways to detect the navigation bar on Android Pie. Thank you very much.
You can get navigation bar height to know it's visible or not visible by Display.getRealMetrics(include navigation bar),
Display.getMetrics(not include navigation bar).
As many of you already know, Samsung has introduced option to hide navigation bar by double-clicking on small dot in bottom-left corner.
I need to figure out if it is hidden or not, so I tried to do that by getting its height.
It looks like it always 144, no matter if it's visible or not.
Samsung does in its way, so probably this is not a good way to go.
Is there a way to figure out if navigation bar is hidden or not on Android devices?
There is a task to display the navigation bar on the left side for android 4.4.2. Nothing of the sort found. Is it possible to do this?
Or, for example, to hide the navigation bar, and on the left side add own custom menu on the same level of layouts hierarchy order content is shifted to the size of the menu?
This solution should work everywhere, not just in one application.
Thanks for the help.
As far as I know you see that navigation bar there because you are using emulator genymotion. On real devices you should not be able to see it. Besides, those back button are physical buttons on some devices like samsung s2.
If you want a menu on the left you should implement navigation drawer. Good luck
My problem is quite simple, however not sure if there is a clean/easy fix for this. I have an action bar with one tab. In some devices (motorola xoom) the tab is in the action bar, however in some other devices (Nexus 7, Samsung Galaxy 10 tablet), the stacked action bar shows up with the tab on it.
You can see from the picture below that the tab's text is small enough to for the tab to fit in the main action bar instead of spawning the stacked one... I am using a regular action bar, but I've read through the internet that this also happens in Sherlock.
Is there any way to fix this without having to recur to a customView? I wouldn't really want to change all my implementation (tab listeners, etc), just to do this. Thanks in advance!
I'm making an Android app using tabs for navigation.
I have a problem with the rendering of the last tab in the action bar; it goes off screen and is cropped (this happens as soon as the number of tabs is too big too fit in the screeen width as far as I can tell).
I'm using the ActionBar.NAVIGATION_MODE_TABS navigation mode.
I haven't been able to find any questions with the same problem, any ideas on how to prevent this behavior?
I have already answer a question like that one : Tab item width in Action Bar (Android)