Reputation: 455
The navigation bar is drawn on top of my activity with transparency so that my content can be seen through the navigation bar. This is fine and I want to have it like this. However, there are two types of devices:
How do I know that the device my app is running on is of type 1 above? I.e. how can I programmatically get the answer to "is there a semi-transparent navigation bar put on top of my activity?"
Upvotes: 1
Views: 107
Reputation: 2359
You can try something like:
boolean hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
if(!hasMenuKey && !hasBackKey)
{
// Do whatever you need to do, this device has a navigation bar
}
Upvotes: 1