Many Android 4 phones nowadays have only software buttons (back, home, menu). Unlike hardware buttons they take up space on screen and also don't look very good in games. You might have noticed that it's not possible to hide the button bar completely.
You can hide the system bar using the following:
Low profile mode is very useful for games. It looks like this; left picture normal mode, right picture low profile:
This is how to safely implement it. We make sure that the method will be executed only on ICS and higher:
Note: I am not sure what it does on phones with hardware buttons. If anyone could try and leave a comment - highly appreciated :)
And this is a good way how to use it in AndEngine:
Read more »
You can hide the system bar using the following:
- Root the phone and force the system bar to hide - obviously you can't do this for every one of your players
- Hide buttons temporarily - they show again as soon as you touch the screen
- Dim buttons - this is called low profile mode
Low profile mode is very useful for games. It looks like this; left picture normal mode, right picture low profile:
This is how to safely implement it. We make sure that the method will be executed only on ICS and higher:
@SuppressLint("NewApi")
private void dimSoftButtonsIfPossible() {
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
}
}
Note: I am not sure what it does on phones with hardware buttons. If anyone could try and leave a comment - highly appreciated :)
And this is a good way how to use it in AndEngine:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// do whatever you need here
dimSoftButtonsIfPossible();
}
return false;
}
@Override
public void onPopulateScene(Scene pScene,
OnPopulateSceneCallback pOnPopulateSceneCallback)
throws IOException {
// do whatever you need here
runOnUiThread(new Runnable() {
@Override
public void run() {
dimSoftButtonsIfPossible();
}
});
pOnPopulateSceneCallback.onPopulateSceneFinished();
}
@Override
public synchronized void onResumeGame() {
super.onResumeGame();
// do whatever you need here
runOnUiThread(new Runnable() {
@Override
public void run() {
dimSoftButtonsIfPossible();
}
});
}




